forked from naveenanimation20/JavaSessionsCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDataTypes.java
More file actions
59 lines (49 loc) · 1.19 KB
/
DataTypes.java
File metadata and controls
59 lines (49 loc) · 1.19 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package JavaSessions;
public class DataTypes {
//8:30 AM IST
//this is my first java code
/*this is my java code
and I'm so happy
data types concept*/
public static void main(String[] args) {
//Primitive Data types: int, double, boolean, char
//Non Primitive Data Types: String, Array
//1. int (4 bytes): byte (1byte), long(8 bytes), short(2 bytes)
int i = 10;
i = 20;
int i1 = 20;
int j = 100;
int k = -10;
int p = 0;
int age = 25;
System.out.println(i);
System.out.println(age);
System.out.println(i+j);
//2. double (8 bytes), float(4 bytes)
double d1 = 12.33;
double d2 = -12.33;
double d3 = 100; //100.00
System.out.println(d1);
//3. char:
char c1 = 'a';
char c2 = '$';
char c3 = '1';
char gender = 'M';
//4. boolean:
boolean b1 = true;
boolean b2 = false;
//String: is a class in java
String s1 = "Hello World";
String s2 = "Selenium";
String s3 = "Hi this is my java code";
String s4 = "1000";
String s5 = "12.33";
System.out.println(s1);
System.out.println(s4);
System.out.println(100);
System.out.println("Hello Testing");
System.out.println(s1+s2);
float v = (float) 12.33;
System.out.println(v);
}
}