-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJavaDatatypes.java
More file actions
29 lines (21 loc) · 920 Bytes
/
Copy pathJavaDatatypes.java
File metadata and controls
29 lines (21 loc) · 920 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
public class JavaDatatypes {
public static void main(String args[]) {
byte byt = 10; // Any random number // can only store upto 256 bytes
System.out.println(byt);
char ch = 'a'; // Used to store the single character
System.out.println(ch);
boolean var = false; // used to store true or false
System.out.println(var);
float price = 10.55f; // used to store a decimal value
System.out.println(price);
int number = 25; // used to store whole number
System.out.println(number);
// long = it is used when we have to store a big value in number
//double = it is used when we have to store a big decimal value in number
short n = 240; //used to store a short number
System.out.println(n);
int a = 10;
int b = 30;
System.out.println(a+b);
}
}