-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLab001.java
More file actions
31 lines (21 loc) · 804 Bytes
/
Copy pathLab001.java
File metadata and controls
31 lines (21 loc) · 804 Bytes
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
31
package src.basic001;
public class Lab001 {
public static void main(String[] args){
byte age= 10; // -128 t0 127
//age=128; can't store --> 128 out of range
age =127;
System.out.println(age+1);// o/p --> 128 Q/A
//age=age+1;
System.out.println(age);// can't able to print because out of range
/* Local variable
Variable is used within the main method (public static void main(string[] args))
Outside the main method it is not accessible eg: age is local variable
*/
short $ = 128;
System.out.println($);
// short _ = 128; // can't be used
short _age = 124;
System.out.println(_age);
String $notes ="Written"; //variable can start with only _ and $
}
}