/*Hi all ,
Please help me in inheritance ,
what in multiple inheritance
what is the use?
please go through the example and help me..........
*/

//parent class
class A{
public void printA(){System.out.println("in the class A");}//simple method
in parent class
public void printB(){}//if A b=new B(); is using then this method be also in
the parent class WHY? as in interface so what is the differnce
public void printC(){}//       new C();         ""
                             ""
}
//subclass B
class B extends A{
public void printB(){
this.printA();//if A a=new A();then a.printA() then also get the output in
the class A then why use the extends A
System.out.println("in the class B");}
}
//subclass C
class C extends A{
public void printC(){
super.printA();//if A a=new A();then a.printA() then also get the output in
the class A then why use the extends A
System.out.println("in the class C");}
}
//the main class
class D extends A{
public static void main(String  ar[]){
A b=new B();//B b=new B(); if this is the case there is no need of printB
&printC in the parent class is this necessary for interface
A c=new C();//C c=new C();
b.printB();
c.printC();
System.out.println("hi hello in the main class the D");
}
}
//even though the A a=new A();a.printA(),B b=new B() then b.printB() & C
c=new C(); c.printC() all will give the wanted out put then why are we
going
//behind the interface ,abstract class,etc.....
//please change the programe to interface option and abstract option so that
i can get the use in a helpful manner
//thanks

-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en

Reply via email to