🎴 Flashcard Mode

Core Java (GATE - CS)

Card1 / 15
Mastered0
Review0
QuestionClick to flip

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 ();
}
}

AnswerClick to flip back
A
Removing the Y () constructor
💡 Explanation:

This change will also not allow the code to compile because there is no error in that constructor.

Change Mode