Leave a Reply 3

Your email address will not be published. Required fields are marked *


pojo

pojo

class Star {
public void doStuff(){
System.out.println(“Twinkling Star”);
}
}

interface Universe{};

class Sun extends Star implements Universe{
public void doStuff(){
System.out.println(“Shining Sun”);
}
}
public class SampleClass {
public static void main(String[] args) {
Sun obj2= new Sun();
Star obj3= obj2;
((Sun)obj3).doStuff();
((Universe)obj2).doStuff();
}
}

===> C

pojo

pojo

class Star {
public void doStuff(){
System.out.println(“Twinkling Star”);
}
}

interface Universe{
public void doStuff();
};

class Sun extends Star implements Universe{
public void doStuff(){
System.out.println(“Shining Sun”);
}
}
public class SampleClass {
public static void main(String[] args) {
Sun obj2= new Sun();
Star obj3= obj2;
((Sun)obj3).doStuff();
((Star)obj2).doStuff();
((Universe)obj2).doStuff();
}
}
==> A