Govt Exams
String concatenation: "5" + 3 becomes "53", then "53" + 2 becomes "532". Once a String is involved, + performs concatenation.
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.
Operators *, / have same precedence and are evaluated left to right: ((10 * 2) / 5) * 2 = (20 / 5) * 2 = 4 * 2 = 8.
Option A fails (300 exceeds byte range). Option B works with explicit casting. Option C works (char to int conversion is implicit).
&& has higher precedence than ||. So: (true && false) || true = false || true = true.
The 'f' suffix indicates a float literal. The output will be 5.5 (trailing zeros are not shown in standard printing).
Both 'L' and 'l' suffixes are valid for long literals in Java, though 'L' is preferred as it's less confusing with '1'.
++x increments x to 6 and uses it, then x++ uses 6 and increments to 7. So 6 + 6 = 12.
Characters are treated as their ASCII values in arithmetic operations. 'A' (65) + 'B' (66) = 131.