Examlex

Solved

Which of the Following Class Definitions Is Correct in Java

question 13

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:

Dividends Declared

Profits distributed by a company to its shareholders out of its earnings, based on the number of shares owned.

Retained Earnings

Profits that a company has earned to date, less any dividends or other distributions paid to shareholders, often reinvested in the business or kept as a reserve.

Cost Of Goods Sold

The direct costs attributable to the production of the goods sold by a company, including materials and labor costs, but excluding indirect expenses.

Related Questions