0% found this document useful (0 votes)
11 views4 pages

Class3 Java

Uploaded by

gholapatharv36
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views4 pages

Class3 Java

Uploaded by

gholapatharv36
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Experiment no.

Title: Programs on various types of inheritance and exception handling

Name: Sharvil Sunil Sawant

class : SE,B3 Roll no.: 159

Program Code:

class A {

private int i;

private String s;

public A() {

System.out.println("Inside Default Constructor of A");

public void setI(int i) {

this.i = i;

public void setS(String s) {

this.s = s;

public int getI() {

return i;

public String getS() {

return s;

public void display() {

System.out.println("display function Inside class A");


}

class B extends A {

public B() {

System.out.println("Inside Default Constructor of B");

public void display() {

System.out.println("display functin Inside class B");

class C extends B {

public C() {

System.out.println("Inside constructor of C");

public void display() {

System.out.println("display function Inside class C");

interface D1 {

public void display1();


}

interface D2 {

public void display1();

class D extends A

implements D1,D2

public void display1() {

System.out.println("dispaly1 of interface D1");

public void display2() {

System.out.println("display2 of interface D2");

class Class3 {

public static void main(String arg[]) {

System.out.println("Calling constructor of A");

A a = new A();

System.out.println("Calling constructor og B");

B b = new B();
System.out.println("Calling construcctor of C");

C c = new C();

System.out.println("Calling construcctor of D");

D d = new D();

d.display();

d.display1();

d.display2();

a.setS("Arpita");

a.setI(12);

a.display();

b.display();

c.display();

output:

You might also like