Govt. Exams
Entrance Exams
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.
charAt() uses 0-based indexing. Index 1 refers to the second character, which is 'e' in "Hello".
Multi-line comments in Java use /* */ syntax. Single-line comments use //. Other syntaxes are for different languages.
The 'f' suffix indicates a float literal. The output will be 5.5 (trailing zeros are not shown in standard printing).
Variable names must start with a letter, underscore (_), or dollar sign ($). They cannot start with digits, contain hyphens, or be reserved keywords.
The 'final' keyword prevents a class from being extended/inherited. A final class cannot have subclasses.
Integer division in Java results in an integer. 5/2 = 2 (remainder is discarded). To get 2.5, at least one operand must be float/double.