Data & Variables
A Basic Java Program w/ Variables
class Main {
public static void main(String[] args) {
int age = 31;
float temp = -2.5f;
double large_decimal = 12345.6789;
char grade = 'A';
String name = "Mr. Park";
boolean working = false;
System.out.println("Age: " + age);
System.out.println("Current Outside Temperature: " + temp);
System.out.println("Large Decimal:" + large_decimal);
System.out.println("Letter Grade: " + grade);
System.out.println("Name: " + name);
System.out.println("Are they working?: " + working);
}
}The 6 Data Types
Integer : int
intDecimals : float
floatLonger Decimals : double
doubleText : String
StringSingle Character : char
charTrue & False Values : boolean
booleanVariables
Variable Formatting
Variable Naming Conventions
Data Type and Their Storage Size
Data Type
RAM Storage Size
Constants
SOURCES
Last updated