-
Notifications
You must be signed in to change notification settings - Fork 1
/
All_Java_Datatypes.java
48 lines (29 loc) · 1.05 KB
/
All_Java_Datatypes.java
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
//Basic Introduction to DataTypes in Java
//2019 Java Learning Repo
//written by rwx-777
public class All_Java_Datatypes {
public static void main(String[] args) {
//This is an introduction to all the different Java DataTypes there are.
//The Basic DataTypes in Java are called Primitive Data Types
boolean This_is_a_Bool = true; //by default a Boolean is false
//Size = 1 bit
//If memory is short use this
byte This_is_a_Byte = 1; //by default its 0
//Size = 8 bits
//Declaring a character
char This_is_a_char = 'G'; //by default \u0000
//Size = 16 bits
// If you are short on memory you can use this too
short This_is_a_short = 3; //by default 0
//Size = 16 bits
//Integer Data Types are generally used for numeric values
int This_is_a_Int = 777; //by default 0
//Size 32 bits
long This_is_a_long = 373676424; //by default 0
//Size 64 bits
float This_is_a_float = 4.67676f; //by default 0.0
//Size = 32 bits
double This_is_a_double = 345.567; //by default 0.0
//Size = 64 bits
}
}