Monday, May 4, 2015

JAVA - Override

JAVA - Override

 

public class main extends A{
public static void main(String[] args) {
main obj = new main();
}    
public main()
{
    printinfo();
}
    @Override
        public void printinfo() {
            super.printinfo();
            System.out.println("HI");
        }
}


 
public class A {
    
        int w=10;
        public void printinfo()
        {
            System.out.println("super class  "+w);
        }
}

No comments:

Post a Comment