mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 07:12:31 +03:00
Merge pull request #1300 from dhwanishah/javaPageChange
Added how to declare and initialize variables for single and multiple instances
This commit is contained in:
commit
84a2cd0748
@ -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;
|
||||
|
@ -709,4 +709,4 @@ If you're coming from a language with good package management, check out
|
||||
[Composer](http://getcomposer.org/).
|
||||
|
||||
For common standards, visit the PHP Framework Interoperability Group's
|
||||
[PSR standards](https://github.com/php-fig/fig-standards).
|
||||
[PSR standards](https://github.com/php-fig/fig-standards).
|
Loading…
Reference in New Issue
Block a user