Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class SuperClass {
- protected void printHello() {
- System.out.println("Hello From SuperClass");
- }
- }
- class SubClass extends SuperClass {
- public void printHello() {
- System.out.println("I will call SuperClass now");
- super.printHello();
- System.out.println("Hello From SubClass");
- }
- }
- public class Sample {
- public static void main(String... argv) {
- SubClass subObject = new SubClass();
- subObject.printHello();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement