-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDatatypes.java
25 lines (23 loc) · 1.02 KB
/
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
package com.company;
public class Datatypes {
public static void main(String[] args) {
// Primitive Data Types
int rollno = 45; // Size = 4 bytes
char last = 'h'; // Size = 2 bytes
float marks = 34.5f; // Size = 4 bytes
double longdecimal = 67623876.647236; // Size = 8 bytes
long longinteger = 356756224L; // Size = 8 bytes
boolean value = false; // Size = 1 bit
// primitives are stored in stack memory
// objects are stored in heap memory
System.out.println("Your Roll Number is "+rollno);
System.out.println("last character is "+last);
System.out.println("Your Marks are "+marks);
System.out.println(longdecimal);
System.out.println(longinteger);
System.out.println(value);
// Non-Primitive
String name = "Suryansh Sharma";
System.out.println("Your Name is "+name);
}
}