Java Tutorial · Chapter 5 of 12
Java Variables
Store typed values.
Common beginner types: int, double, boolean, char, and String.
Declare a type before the name: int score = 90;
Variable sample
Try it Yourself »
public class Main {
public static void main(String[] args) {
int age = 18;
System.out.println("Age: " + age);
}
}
Classroom Tips
- String uses capital S.
- Initialize before reading a value.