In an object-oriented language, all data should be encapsulated as objects.
Java has 8 primitive scalar types:
int
,long
,short
,byte
float
,double
char
boolean
Size of each type is fixed in JVM
true
and false
f
after number for float, else interpreted as double.//
.
/
is integer division.
Math.pow(a,n)
→ $a^n$String s,t;
String s="Hello", t="World";
+
is overloaded for concatenation of StringsString s = "Hello";
String t = "World";
String u = s + " " + t;
s[3]='p'
or s[4]='!'