-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLab_26_Local_Variable.java
More file actions
30 lines (28 loc) · 1.05 KB
/
Lab_26_Local_Variable.java
File metadata and controls
30 lines (28 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package ex_02_JavaBasic;
public class Lab_26_Local_Variable {
public static void main(String[] args) {
int a = 10;
// local veriable means only valid in a this main function .
// within {}
byte b = 10;
short c = 20;
long d = 1236547890l;
float e = 3.14f;
double f = 65.2665656;
boolean g = true;
char h = 'c';
// char i = "c"; // not posible -> ""
/*
* Rule : Default value of the Local Variable is not assigned by the JVM.(Error)
*
* Rule need to remember - Local Variables
* Defaualt value of char is not space. 0
* Defaualt - byte -> 0
* Local variable must be initialiesd before using.
* You can declare multiple variables of same data types in a single statement.
* We can't use const keyword to declare cosntant.
* Value of the final variable can not be changed.
* Value of the varible can be change any number of times during program execution.*/
System.out.println(a);
}
}