Constructor and its properties


Question 1: In Java, System.out.println is mainly used to display the data on the print stream.

In System.out.println

"System" is a predefined class. "Out" is object of printStream Class, and "println" is the method of the printStream class.

Simulate the System.out.println in your program in such a way that if you invoke S.O.disp( int) it must be able to print the data on screen.

Question 2: When do we declare the method or class final?

Question 3: When do we declare the method or class abstract?

Question 4: An organization wants to maintain a database of its employees. The database is divided into a number of classes whose hierarchical relationship is illustrated in the figure all along with the minimum required information for each and every class.

1843_hierarchical relationship of database.jpg

Write down a program to store data and retrieve individual information as and when needed.

Question 5: What do you mean by the term constructor? What are its unique properties and how do we invoke it?

Question 6: Determine the errors in the given code, if any.

Class A
{
int type;
A (int t)
{
type = t;
}
Class B extends A
{
String x = " ";
}

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: Constructor and its properties
Reference No:- TGS08719

Expected delivery within 24 Hours