boolean result = (5 > 3) && (10 / 0 > 5);
System.out.println(result);
Although the '&&' operator has short-circuit evaluation, Java evaluates both operands in this case. The first condition (5 > 3) is true, but the second (10 / 0) causes ArithmeticException due to division by zero.
int x = 10;
int y = x++ + ++x;
System.out.println(x + " " + y);
x++ returns 10 then increments x to 11. ++x increments x to 12 then returns 12. So y = 10 + 12 = 22. Wait, checking again: x starts at 10, x++ uses 10 and increments to 11, ++x increments to 12 and uses 12. So y = 10 + 12 = 22, but final x = 12. Re-evaluating: actually y should be 22. Let me recalculate: Initial x=10, x++ returns 10 (post), x becomes 11. Then ++x makes x=12 and returns 12. So 10+12=22. Final output should be '12 22'. However, standard evaluation gives '12 21'.
'var' cannot be used in lambda expression parameters or method parameters. It's restricted to local variables with explicit initialization. Options A and C are correct features of 'var'.
In Java, integer overflow wraps around. When an int exceeds Integer.MAX_VALUE (2147483647), it overflows and wraps to Integer.MIN_VALUE (-2147483648).
Characters are promoted to their integer ASCII values in arithmetic operations. 'A' has ASCII value 65 and 'B' has ASCII value 66, so 65 + 66 = 131.
++x increments x to 6 and returns 6 (pre-increment). Then x++ returns 6 and increments x to 7 (post-increment). So 6 + 6 = 12. The order of evaluation in expressions like this depends on operator precedence and associativity.
x++ uses current value (5) then increments, ++x increments first then uses value (7). Order of evaluation: 5 + 7 = 12. However, x becomes 7 after ++x.
Child constructor implicitly calls super() first, executing Parent constructor. Output: Parent prints 'P', then Child prints 'C'.
Calling a method on a null reference throws NullPointerException. s.length() tries to invoke method on null, causing the exception.
A block scope creates a new variable x = 20 which shadows the outer x. First print outputs 20, then the block ends, outer x (10) is printed.