Examlex

Solved

Which of the Following Class Definitions Is Correct in Java

question 41

Multiple Choice

Which of the following class definitions is correct in Java?
(i)
Public class Employee
{
Private String name;
Private double salary;
Private int id; public Employee()
{
Name = "";
Salary = 0.0;
Id = 0;
} public Employee(String n, double s, int i)
{
Name = n;
Salary = s;
Id = i;
} public void print()
{
System.out.println(name + " " + id + " " + salary) ;
}
}
(ii)
Public class Employee
{
Private String name;
Private double salary;
Private int id; public void Employee()
{
Name = "";
Salary = 0.0;
Id = 0;
} public void Employee(String n, double s, int i)
{
Name = n;
Salary = s;
Id = i;
}
Public void print()
{
System.out.println(name + " " + id + " " + salary) ;
}
}


Definitions:

Mortgagor

The borrower in a mortgage loan agreement, who pledges property to the lender as security for the loan.

Eminent Domain

The power of the government to take private property for public use, with compensation to the owner.

Privately Owned Land

Land that is owned by individuals or entities other than the government, with the owners maintaining control and rights over the property.

Single-family Dwelling Ordinance

A municipal regulation which specifies zoning laws and construction standards primarily for houses intended for single families.

Related Questions