diff options
| author | Dhwani Shah <dshah202@gmail.com> | 2015-10-02 14:30:45 -0500 | 
|---|---|---|
| committer | Dhwani Shah <dshah202@gmail.com> | 2015-10-02 14:30:45 -0500 | 
| commit | 8e388cd3344b90cfdc02741359850a2352a8f9b7 (patch) | |
| tree | 7659e92f90c0667d2f565e8847448edbedb816a5 | |
| parent | fb43ef2942f29ece285be3e8944c91bde6306095 (diff) | |
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.
| -rw-r--r-- | java.html.markdown | 24 | 
1 files 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 <type> <name> +        int fooInt; +        // Declare multiple variables of same type <type> <name1>, <name2>, <name3> +        int fooInt1, fooInt2, fooInt3; + +        /* +        *  Variable Initialization +        */ + +        // Initialize a variable using <type> <name> = <val> +        int fooInt = 1; +        // Initialize multiple variables of same type with same value <type> <name1>, <name2>, <name3> = <val> +        int fooInt1, fooInt2, fooInt3; +        fooInt1 = fooInt2 = fooInt3 = 1; + +        /* +        *  Variable types +        */          // Byte - 8-bit signed two's complement integer          // (-128 <= byte <= 127)          byte fooByte = 100;  | 
