Java Data Types
Explore common Java data types such as int, double, char, boolean and String.
Java Code
Study the example and understand what each part does.
public class Main {
public static void main(String[] args) {
int age = 20;
double price = 1500.75;
char grade = 'A';
boolean active = true;
String name = "Vincent";
System.out.println(age);
System.out.println(price);
System.out.println(grade);
System.out.println(active);
System.out.println(name);
}
}
Java code normally runs using the Java Development Kit on a computer, Android Studio or another Java development environment. This course page presents the code examples without pretending that the browser is running Java directly.
Expected Output / Result
20 1500.75 A true Vincent
Finished this lesson?
Mark it complete to update your course progress.