1.3 Expressions and Assignment Statements
Expressions are combinations of variables, operators, and method calls that evaluate to a single value. Assignment statements are used to store the result of an expression in a variable.
Expressions
Expressions can involve arithmetic operations, comparisons, or more complex calculations.
int x = 5;
int y = 3;
int sum = x + y; // sum is now 8
boolean isGreater = x > y; // isGreater is true
Assignment Statements
Assignment statements use the = operator to assign a value to a variable.
int a; // Declaration
a = 10; // Assignment
int b = 20; // Declaration and assignment in one statement