Skip to content

Instantly share code, notes, and snippets.

@webcane
Created November 20, 2012 07:13
Show Gist options
  • Save webcane/4116527 to your computer and use it in GitHub Desktop.
Save webcane/4116527 to your computer and use it in GitHub Desktop.
OCA-JP-7 PT1 Q17
// 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