Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Demo
- {
- public static void main(String...args)
- {
- Demo d = new Demo();
- if(d instanceof Object)
- System.out.println("This class is an instance of object, without extending it");
- Object o = d;
- System.out.println("\nfurther, Object 'o' is referring d. Only superclass reference can refer subclass object");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement