Java variables, types, and casting
Java is statically typed: every variable has a type that is fixed when it is declared. The primitive types include int (32-bit), long (64-bit), double, boolean, and char. A larger literal needs the right suffix, such as the L in 3_000_000_000L, and underscores can make long numbers readable.
Java
class Main {
public static void main(String[] args) {
int count = 7;
long big = 3_000_000_000L;
double ratio = count / 2;
double exact = count / 2.0;
int overflow = Integer.MAX_VALUE + 1;
char letter = 'A';
letter += 2;
boolean flag = count > 5 && big > count;
System.out.println(ratio + " " + exact);
System.out.println(overflow);
System.out.println(letter + " " + (int) letter);
System.out.println(flag);
System.out.println((int) 3.99 + " " + Math.round(3.99));
}
}