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.

This commit is contained in:
Dhwani Shah 2015-10-02 14:54:09 -05:00
parent c7240369b6
commit 63793af2e9
2 changed files with 23 additions and 5 deletions

View File

@ -47,10 +47,30 @@ public class LearnJava {
///////////////////////////////////////
// Types & Variables
// Variables
///////////////////////////////////////
/*
* Variable Declaration
*/
// Declare a variable using <type> <name>
int fooInt;
// Declare multiple variables of the 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;

View File

@ -101,9 +101,7 @@ $sgl_quotes
END;
// String concatenation is done with .
echo 'This string ' . 'is concatenated';
// Strings concatenation can also be combined with html elements
echo 'This string is' . '<strong>' . 'bold with strong tags ' . '</strong>.'
echo 'This string ' . 'is concatenated';
/********************************