Glossary
Camel Casing
A naming convention where the first letter of the first word is lowercase, and the first letter of subsequent words are uppercase, with no spaces.
Example:
Naming a variable to store a user's favorite color would follow Camel Casing: String userFavoriteColor;.
Declaration
The process of defining a variable's data type and name before it can be used. It reserves memory for the variable.
Example:
The line int age; is a declaration that tells Java you'll be using a variable named age to store an integer.
Initialization
The process of assigning an initial value to a variable when it is declared or shortly thereafter. This ensures the variable has a known state.
Example:
When you write int score = 0;, you are performing initialization by giving the score variable its starting value of 0.
Integer Overflow
A condition that occurs when an arithmetic operation attempts to create a numeric value that is outside the range that can be represented by the `int` data type. The value 'wraps around' to the opposite end of the range.
Example:
If you add 1 to Integer.MAX_VALUE, instead of getting a larger number, you'll experience an Integer Overflow and get Integer.MIN_VALUE.
Reserved Words
Keywords in Java that have predefined meanings and cannot be used as identifiers (like variable names, method names, or class names).
Example:
You cannot name a variable class or public because these are reserved words in Java.
Scope
The region of a program where a variable or method can be accessed. It determines the visibility and lifetime of an identifier.
Example:
A variable declared as private has a limited scope, meaning it can only be accessed from within its own class.
String
A non-primitive (reference) data type in Java used to store sequences of characters, such as text or names.
Example:
Storing a person's full name, like 'Alice Wonderland', would be done using a String variable: String userName = "Alice Wonderland";.
Strongly Typed
A characteristic of Java where every variable must have a declared data type, and once declared, its type cannot be changed. This helps prevent type-related errors.
Example:
Because Java is strongly typed, you cannot assign a String value to an int variable after it has been declared as an int.
Variable
A named storage location in a program's memory that holds a value of a specific data type. Variables allow data to be stored and manipulated.
Example:
In int score = 100;, score is a variable that stores the integer value 100.
boolean
A primitive data type in Java that can only store one of two truth values: `true` or `false`.
Example:
To check if a user is logged in, you might use a boolean variable: boolean isLoggedIn = true;.
double
A primitive data type in Java used to store decimal numbers (floating-point numbers) with high precision.
Example:
Calculating a student's GPA, which often includes decimal points, requires a double variable, such as double studentGPA = 3.85;.
int
A primitive data type in Java used to store whole numbers (integers) without any decimal points.
Example:
To keep track of how many lives a player has left in a game, you would use an int variable like int playerLives = 3;.