Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners How to access Subclass?
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Virender Kumar
How to access Subclass?
1 Answer(s)      3 years and 6 months ago
Posted in : Java Beginners


How to access subclass in java? please tell me the syntex with an example.


Advertisement
View Answers

June 27, 2011 at 5:31 PM


class SuperClass{
    public void hello(){
        System.out.println("Hello World");
    }
}
class SubClass extends SuperClass{
    public void hello(){
        super.hello();
        System.out.println("Welcome");
    }
}
class SubClassExample{
    public static void main(String[] args) 
    {
        SubClass c=new SubClass();
        c.hello();
    }
}


Related Tutorials/Questions & Answers:
Advertisements
 

 

 

DMCA.com