Govt Exams
protected allows access within the same package and to subclasses even outside the package.
== compares object references (memory location), while .equals() compares the actual string content.
Package names follow a hierarchical structure using dots (e.g., com.example.app). Package statement must be the first non-comment statement.
The 'final' keyword prevents a method from being overridden by subclasses.
Java identifiers cannot start with a digit. Valid identifiers must start with a letter, underscore, or dollar sign.
Math.max(5, 10) = 10, Math.min(3, 8) = 3. So 10 - 3 = 7.
'this' is a reference to the current object instance. It's used to distinguish instance variables from parameters and to call other constructors.
Explicit casting from double to int truncates the decimal part. 5.7 becomes 5 (not rounded).
Ternary operator: condition ? trueValue : falseValue. Since 10 > 20 is false, "B" is printed.
Both syntaxes are valid in Java for declaring 2D arrays. The brackets can be placed after the type or variable name.