Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Star{
- public void doStuff(){
- System.out.println("Twinking Star");
- }
- }
- interface Universe{
- public void doStuff();
- }
- class Sun extends Star implements Universe{
- public void doStuff(){
- System.out.println("Shining Sun");
- }
- }
- public class Bob {
- public static void main(String[] args) {
- Sun obj2 = new Sun();
- Star obj3 = obj2;
- ((Sun)obj3).doStuff();
- ((Star)obj2).doStuff();
- ((Universe)obj2).doStuff();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement