Lesson 2 of 10
Variables & Data Types
Java is strongly typed — you must declare the type of every variable. Primitive types include int, double, boolean, and char. Use String for text (it is an object, not a primitive).
JAVA
int age = 25;
double price = 19.99;
boolean isActive = true;
char grade = 'A';
String name = "Ali";
System.out.println(name);