-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDataType.java
More file actions
33 lines (27 loc) · 1.01 KB
/
DataType.java
File metadata and controls
33 lines (27 loc) · 1.01 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
package JavaBasic;
public class DataType {
public static void main(String[] args) {
// data type in java
// Primitive Data Types
// These data type are stored in the stack memory
byte b = 10;
int age = 25;
double salary = 50000.75;
char grade = 'A';
boolean isJavaFun = true;
float percantage = 75.5f;
// Non-Primitive Data Types
//These are stored in the heap memory and the refrence are stored in the stack memory
String name = "Alice";
int[] marks = {85, 90, 78};
// Printing the values
System.out.println("Byte Value: " + b);
System.out.println("Age: " + age);
System.out.println("Salary: " + salary);
System.out.println("Grade: " + grade);
System.out.println("Is Java Fun? " + isJavaFun);
System.out.println("Name: " + name);
System.out.println("percantage:"+percantage);
System.out.println("Marks: " + marks[0] + ", " + marks[1] + ", " + marks[2]);
}
}