Primitive types and String

Java distinguishes eight primitive types (int, long, double, boolean, char, etc.), which hold a value directly, from reference types such as String, which refer to an object. String is immutable and is compared with equals, not ==. Dividing two int values is an integer division.

Example

int n = 7 / 2; // 3
String s = "Java";
boolean egal = s.equals("Java");

Related concepts

The whole glossary