Question 25 of 76 from exam 1Z0-808: Java SE 8 Programmer I

Question 25 of 76 from exam 1Z0-808: Java SE 8 Programmer I

Question

Given the code fragment:

public class Employee {
String name;
boolean contract;
double salary;
Employee () {
ff line nl
}
public string tostring() {
return name + ":" + contract + ":" + salary;

3
public static void main(string[] args) {
Employee e = new Employee ();
ff line n2
System. out. print (e);

Which two modifications, when made independently, enable the code to print joe:true: 100.0?

O A) Replace line n2 with
e.name = "Joe";
e.contract = true;
e.salary = 100;

(1B) Replace line n2 with
this.name = "Joe";
this.contract = true;
this.salary = 100;

O ©) Replace line ni with
this.name = new String("Joe");
this.contract = new Boolean (true) ;
this.salary = new Double (100);

(11D) Replace line n1 with
name = "Joe";
contract = TRUE;
salary = 100.0f;

CE) Replace line ni with
this("Joe", true, 100);

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D. E.

AC.