Please enable JavaScript to use CodeHS

CodeHS Glossary


Type Java

The type of a variable defines what kinds of values the variable can hold.

These are the basic types in Java:
int – represents integer (whole number) values like 1, 0, -19, 334, etc
double – represents real numbers decimal values like 3.40, 0.0, -12.2214, etc
boolean – represents a true or false statement, can only hold the values true or false
char – represents a single character like ‘a’, ‘F’, ‘;’, etc
String – represents strings of characters like “Hello”, “how are you doing”, etc

So an int variable can only hold integer values, a boolean variable can only hold true or false, etc.