Govt. Exams
Entrance Exams
String concatenation: "5" + 3 becomes "53", then "53" + 2 becomes "532". Once a String is involved, + performs concatenation.
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.
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.
The correct syntax is 'datatype[] arrayName = {elements};' or 'datatype[] arrayName = new datatype[size];'
The length() method returns the number of characters in the string "Java", which is 4 characters.
Java variable names are case-sensitive. 'age' and 'Age' are different variables. Names cannot start with digits, cannot contain spaces, and special characters are not allowed.