Java Programming & Object-Oriented Design Complete Study Notes
Java Programming Fundamentals & Language Constructs
Identifiers & Naming Conventions
An identifier is a sequence of characters used to name variables, methods, classes, and other program constructs.
Allowed Characters: Identifiers consist of uppercase and lowercase letters, digits (), underscores (
_), and dollar signs (). It cannot start with a digit (e.g.,2ndScoreis invalid).Reserved Words & Restricted Tokens: An identifier cannot be a Java reserved keyword (e.g.,
class,static,public,void). It also cannot betrue,false, ornull.Length: Identifiers can be of any length.
Identifier Practice Examples:
studentName: Valid (starts with letter).2ndScore: Invalid (starts with digit)._count: Valid (starts with underscore).class: Invalid (reserved keyword).total$: Valid (contains dollar sign).null: Invalid (reserved literal).

Variables, Primitive Data Types & Memory
A variable declaration specifies two essential attributes: the data type (what kind of value it can hold) and the variable name (how to refer to the stored value in code).
General declaration syntax:
DataType variableName;(e.g.,int count;,double radius;,char grade;).Primitive Variables vs. Reference Variables:
Primitive Variables: Directly store the actual primitive value assigned to them in memory (e.g.,
int number = 25;stores the value25insidenumber).Reference Variables: Store the memory address of an object rather than the object itself. Objects are referenced by variables (e.g., `String cityName =