Core Java (GATE - CS)

Casual Mode - Take your time!

1 / 15
Correct
0
Incorrect
0
Score
0%
Multiple Choice

What changes will make the above code compile?

class X { X () { } private void one () { }
}
public class Y extends X { Y () { } private void two () { one();
}
public static void main (String [] args) { new Y().two ();
}
}

  1. Removing the private modifier from the two () method
  2. Adding the public modifier to the declaration of class X
  3. Changing the private modifier on the declaration of the one() method to protect
  4. Removing the Y () constructor
  5. None of these
Change Mode