Experiment No.-1.4: 2.task To Be Done
Experiment No.-1.4: 2.task To Be Done
Experiment No.-1.4: 2.task To Be Done
BRANCH-CSE SECTION-20BCS43-B
3.CODE-
import java.io.*;
import java.lang.*;
import java.util.*;
class one {
public void print_inheritance()
{
System.out.println("single inheritance");
}
}
CODE-
import java.io.*;
import java.lang.*;
import java.util.*;
class one {
public void print_inheritance()
{
System.out.println("MULTILEVEL");
}
}
// Drived class
public class Main {
public static void main(String[] args)
{
three g = new three();
g.print_inheritance();
g.print_for();
g.print_inheritance();
}
}
OUTPUT
CODE-
class A {
public void print_A() { System.out.println("Class A"); }
}
class B extends A {
public void print_B() { System.out.println("Class B"); }
}
class C extends A {
public void print_C() { System.out.println("Class C"); }
}
class D extends A {
public void print_D() { System.out.println("Class D"); }
}
// Driver Class
public class Test {
public static void main(String[] args)
{
B obj_B = new B();
obj_B.print_A();
obj_B.print_B();
CODE
import java.io.*;
import java.lang.*;
import java.util.*;
interface one {
public void print_inheritance();
}
interface two {
public void print_for();
}
// Drived class
public class Main {
public static void main(String[] args)
{
child c = new child();
c.print_inheritance();
c.print_for();
c.print_inheritance();
}
}
OUTPUT