Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2016
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. class SuperClass {
  2. protected void printHello() {
  3. System.out.println("Hello From SuperClass");
  4. }
  5. }
  6.  
  7. class SubClass extends SuperClass {
  8. public void printHello() {
  9. System.out.println("I will call SuperClass now");
  10. super.printHello();
  11. System.out.println("Hello From SubClass");
  12. }
  13. }
  14.  
  15. public class Sample {
  16. public static void main(String... argv) {
  17. SubClass subObject = new SubClass();
  18. subObject.printHello();
  19. }
  20.  
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement