-
-
Save webcane/4116527 to your computer and use it in GitHub Desktop.
OCA-JP-7 PT1 Q17
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// What will be the output of trying to compile and run the following piece of code? | |
public class Fruit { | |
public void eatMe() throws Exception { | |
System.out.print("Eat a fruit"); | |
} | |
public static void main (String [] args) { | |
Fruit f = new Mango(); | |
f.eatMe(); | |
} | |
} | |
class Mango extends Fruit { | |
public void eatMe() { | |
System.out.println("Eating a mango"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment