Question: In java public class X { public void one ( ) { System,out.print ( Xone ) ; } public void two ( )

In java
public class X{
public void one()
{ System,out.print("Xone");}
public void two()
{ System.out.print("Xtwo");}
}
public class Y extends X{
public void one()
{ System.out.print("Yone");}
public void two()
{ System.out.print("Ytwo");}
public void testIt(){
one();
super.one();
two();
super.two();
3
Consider following code in the main method of another class. What is the output of line 2?
Y}\mathrm{ code = new Y();
code.one(); //line 1
code.testIt(); //line 2
YoneYtwoXoneXtwo
XoneXtwoYoneYtwo
YoneXoneYtwoXtwo
XoneYoneXtwoYtwo
In java public class X { public void one ( ) {

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!