interface Colorable { } interface Bouncable extends Colorable { } class Super implements Bouncable { } class Sub extends Super implements Bouncable { } public class Tester { public static void main(String[] args) { System.out.println(new Sub() instanceof Super); //line 1 System.out.println(new Sub() instanceof Bouncable);//line 2 System.out.println(new Sub() instanceof Colorable);//line 3 System.out.println(new Super() instanceof Sub);//line 4 System.out.println(new Super() instanceof Colorable);//line 5 } }
interface Bouncable extends Colorable { }
class Super implements Bouncable { }
class Sub extends Super implements Bouncable { }
public class Tester {
public static void main(String[] args) {
System.out.println(new Sub() instanceof Super); //line 1
System.out.println(new Sub() instanceof Bouncable);//line 2
System.out.println(new Sub() instanceof Colorable);//line 3
System.out.println(new Super() instanceof Sub);//line 4
System.out.println(new Super() instanceof Colorable);//line 5
}
Oracle Certified Professional Java Programmer
Access: Public Instant Grading
Jobilize.com uses cookies to ensure that you get the best experience. By continuing to use Jobilize.com web-site, you agree to the Terms of Use.