From 8e388cd3344b90cfdc02741359850a2352a8f9b7 Mon Sep 17 00:00:00 2001 From: Dhwani Shah Date: Fri, 2 Oct 2015 14:30:45 -0500 Subject: Added section on how to declare and initialize both single varible and multiple varibles with the same value. Important concept for large structured programs. Seperated this a little bit. --- java.html.markdown | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/java.html.markdown b/java.html.markdown index 928eb39f..0f5b39af 100644 --- a/java.html.markdown +++ b/java.html.markdown @@ -47,10 +47,30 @@ public class LearnJava { /////////////////////////////////////// - // Types & Variables + // Variables /////////////////////////////////////// - + + /* + * Variable Declaration + */ // Declare a variable using + int fooInt; + // Declare multiple variables of same type , , + int fooInt1, fooInt2, fooInt3; + + /* + * Variable Initialization + */ + + // Initialize a variable using = + int fooInt = 1; + // Initialize multiple variables of same type with same value , , = + int fooInt1, fooInt2, fooInt3; + fooInt1 = fooInt2 = fooInt3 = 1; + + /* + * Variable types + */ // Byte - 8-bit signed two's complement integer // (-128 <= byte <= 127) byte fooByte = 100; -- cgit v1.2.3