Variable Declaration and Initialisation
Variable declaration and initialisation varieties are explained here.
- Understanding variable declaration.
- Declaration along with initilisation.
- Separate Assignment after declaration.
- Assignment with a returned value of method.
This is plain variable declaration. No value has been assigned
This is assignment statement only which works on pre-declared variables only.
This is declaration combined with assignment which is also called initialisation.
This is declaration and initialisation of a variable with another pre-assigned variable.
This is declaration and assignment of a variable with return value of a method. The return value should of given variable data type.
- A variable can assigned with –
– A Literal value of given data type.
– A reference to another variable which should be of given data type or possibly convertible data type
– A call to a method which returns the value of given data type. Some times this is also called dynamic initialisation.
- The oracle documentation for variable and other definitions can be seen at.
Suggested Filename(s): VarDecInit.java
sunmitra| Created: 20-Mar-2018 | Updated: 21-Mar-2018|