What is the result?

Given the code fragment

What is the result?
A. Result A 1 Result B 3
B. Result A 01 Result B 3
C. Result A 01
Result B 12
D. Result A 1
Result B 12

Download Printable PDF. VALID exam to help you PASS.

6 thoughts on “What is the result?

  1. if ints where on the left side arithmetic would be performed then sum would be concatenated with the string

  2. Answer C:

    If either of the operands is String, then the operation is concatenation. And since the numbers are on the right hand side, the concatenation precedes.

  3. Answer is C

    public class Test {
    public static void main(String[] args) {
    System.out.println(“Result A ” + 0 + 1);
    System.out.println(“Result B ” + (1) + (2));
    }
    }

Leave a Reply

Your email address will not be published.