-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfile4.java
21 lines (21 loc) · 908 Bytes
/
file4.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
public class file4 {
public static void main(String args[]){
// output
// Java is a statically typed language which is you have to tell what is the type of the variable
//Data types can be divided into two different types : primitive and non primitive
// Primitive : byte (1 byte = 8 bits), short , char (2 bytes), boolean(1), int(4), long(8), float(4), double (8) each data type uses different amount of memory
// Non-primitive : String, Array, Class, object and interface
int a = 10;
int b = 5;
System.out.println(a+b);
// Variables
String name = "Hello harneet";
int age = 22;
double price = 25.25;
System.out.println(price-b);
System.out.println(a*b);
System.out.println((a*b)/(a-b));
System.out.println(a*b/a-b);
// priority of operations: * / % > -+
}
}