Computer Science, asked by premakolukulapally, 1 month ago

class Student{

private int htno;

private String sname;

Student()

{

htno=1234;

sname="SNIIT";

}

void display(){

System.out.println("Student Details");

System.out.println(" Ht no: "+htno);

System.out.println("Name : "+sname);

}

}

public class DefaultCon {

public static void main(String[] args) {

Student s=new Student();

s.display();

}

}

what is the output​

Answers

Answered by RishikaRachunuri
0

Answer:

What i should answer what is the question

Answered by Anonymous
0

In the program, we can see that it uses inheritance, Student is the base class or the child class and DefaultCon is the derived class of the child class.

When the static method of DefaultCon is used, a new object of Student is created.

Memory locations are created for htno and sname and the values are stored as shown: htno=1234   sname="SNIIT"

Then, the display() method of Student is called.

So, the output will be,

Student Details

Ht no: 1234

Name : SNIIT

Similar questions