- You must spell things correctly, or at least consistently.
- Java is a class-based language where everything is defined within a class, and the class name must match the file name.
- The Main Method controls the program's actions.
- System.out generates output to the console.
- System.out.print() displays text and keeps the cursor on the same line.
- System.out.println() displays text and moves the cursor to the next line.
- A string literal is a sequence of characters enclosed in double quotes (e.g., "This is a string literal.").
- Syntax errors, such as missing semicolons, prevent the program from compiling.
- Logic errors occur when the program runs but produces incorrect results due to faulty reasoning.
- A type defines a set of values and operations on them.
- Data types can be primitive (e.g., int, boolean, double) or reference types.
- Variables consist of letters, digits, or underscores and are case-sensitive.
- Variable names cannot start with a digit or use spaces or special characters.
- Use camel case for variable names (e.g., myVariable).
- A literal represents a fixed value (e.g., numbers, characters).
- Arithmetic operations include +, -, *, /, and % (modulus).
- Operator precedence determines the order of arithmetic operations. Parentheses take precedence over *, /, %, followed by + and -.
- Compound assignment operators include +=, -=, *=, /=, %=.
- Increment (++) and decrement (--) operators add or subtract 1 from a variable.
- Division with integers truncates the decimal part. Use double to get a floating-point result.
- Integer.MAX_VALUE and Integer.MIN_VALUE represent the largest and smallest possible integer values.