Multiple choice technology programming languages

package overriding; class Super2 { void testSuper(int empId) { System.out.println("I am in Super " + empId); } } public class TestOverrideSub2 extends Super2 { public void testSuper(int empId) { System.out.println("I am in Sub " + empId); } public static void main(String[] args) { Super2 s2 = new TestOverrideSub2(); s2.testSuper(144670); } }

  1. I am in Sub 144670

  2. I am in Super 144670

  3. Compiler error

  4. Exception

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

The subclass widens access from default to public, which is valid in overriding. When calling through a superclass reference pointing to a subclass object, Java uses the actual object's type (Sub), so the subclass version executes.