class A
{
A()
{
System.out.println("Constructor of A ");
}
public void show()
{
System.out.println ("method of class A");
}
}
class B extends A
{
B()
{
System.out.println("Constructor of B");
}
public void show()
{
System.out.println ("method of class B");
}
}
class C extends B
{
C()
{
System.out.println("Constructor of C");
}
public void show()
{
System.out.println("method of class C");
}
}
public class D
{
public static void main (String args [])
{
A obj1 = new A();
A obj2 = new B();
B obj3 = new C();
obj1.show();
obj2.show();
obj3.show();
}
}
class Base
{
void sum (int a, int b)
{
System.out.println ("The sum of integer: "+(a+b));
}
void sum (double a, double b)
{
System.out.println ("The sum of double: "+(a+b));
}
void sum (String a, String b)
{
System.out.println ("The sum of String: "+(a+b));
}
}
public class Derive
{
public static void main(String args[])
{
Base base = new Base();
base.sum(45,35);
base.sum(61.3,45.7);
base.sum("Java", " Tutorial");
}
}
class OverLoadDemo
{
void sum (int a, int b)
{
System.out.println ("The sum of integer: "+(a+b));
}
void sum (double a, double b)
{
System.out.println ("The sum of double: "+(a+b));
}
void sum (int a, double b)
{
System.out.println ("The sum of int and double: "+(a+b));
}
void sum (String a, String b)
{
System.out.println ("The sum of String: "+(a+b));
}
public static void main(String args[])
{
OverLoadDemo over = new OverLoadDemo();
over.sum(20,35);
over.sum(21.3,18.7);
over.sum(17, 24.6);
over.sum("CareerRide", " Info");
}
}
class Base
{
public void show(int a)
{
System.out.println("show method of Base class");
}
public void display()
{
System.out.println("display method of Base class");
}
}
public class Derive extends Base
{
public void show(int a)
{
System.out.println("show method of Derive class");
}
public void xyz()
{
System.out.println("xyz() method of derive class");
}
public static void main( String args[])
{
Base obj = new Derive();
obj.show(2);
obj.display();
}
}