Govt. Exams
Entrance Exams
The compound assignment operator += means x = x + 3. So 5 + 3 = 8.
Both operands are integers, so integer division is performed. Result is 3 (not 3.33). To get decimal, at least one operand must be float/double.
The 'instanceof' operator is used to check if an object is an instance of a specific class or implements a specific interface.
The 'super' keyword is used to refer to parent class members and invoke parent class constructors.
Variable names can contain letters, digits, underscores, and dollar signs, but cannot start with a digit or contain hyphens or dots.
'const' is not a Java keyword. The correct convention for constants is public static final. Option D also works but C follows the standard convention.
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.