Multiple choice technology programming languages

public class Top { private int i; Top(int i) {this.i=i; } public int getValue(){ return this.i; } } class Bottom{ public static void main(String[] args) { Top tp = new Top(5); String j = Integer.toString(tr.getValue()); tp.i=15; System.out.println( tp.i + j); } }

  1. 155

  2. Compilation error

  3. Exception

  4. 20

  5. 5 5

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The code fails to compile because the variable 'tr' is undefined (it should be 'tp'), and the main method attempts to access a private field 'i' of class Top directly, which is forbidden in Java.