Variables and Types
Java is very precise. Before you tell it to remember something, you must tell it exactly what type it is.
And every sentence must end with a semicolon (;).
How Java remembers things
int number = 2026;
String welcome = "Hello, Java!";
Translation:
Remember one number (int) named number with the value 2026;
Remember one string (String) named welcome with the value "Hello, Java!";
What Java understands
There are only a few basic types the computer can remember.
int number = 10; // integer
double decimal = 3.14; // floating-point number
String text = "Hello"; // text
boolean truth = true; // true or false
Use what you remembered
int x = 100;
System.out.println(x);
Think of it like this: when you ask Java to do something, you always say,
“This is a number!” or “This is text!” first.
And do not forget the ; at the end.