-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDataTypes.java
More file actions
33 lines (27 loc) · 884 Bytes
/
DataTypes.java
File metadata and controls
33 lines (27 loc) · 884 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
32
33
public class DataTypes {
public static void main(String[] args) {
boolean flag = true;
char n = 100;
char n1 = 'R';
short num = 23;
int x = 2312;
long l = 3412;
float f = 34.5f;
double d = 42.75;
String name = "Ram";
String name_2 = "Ram";
// Compare value of two variables
System.out.println(name.equals(name_2));
// Compare reference/address of two variables
System.out.println(name == name_2);
String userName = new String("Ram");
System.out.println(name.equals(userName));
System.out.println(name == userName);
int arr_1[] = new int[5];
int arr_2[] = {32,2,6,7};
int []arr_3 = {32,2,6,7};
int[] arr_4 = {32,2,6,7};
Integer x1 = 10;
int i1 = x1;
}
}