subject

Consider the following class definition.

public class Person {
private String name; /* missing constructor */
}
The statement below, which is located in a method in a different class, creates a new Person object with its attribute name initialized to "Washington". Person p = new Person("Washington");

Which of the following can be used to replace /* missing constructor */ so that the object p is correctly created?

A)
private Person()
{
name = n;
}
B)
private Person(String n)
{
name = n;
}
C)
public Person()
{
name = n;
}
D)
public Person(String n)
{
name = n;
}
E)
public Person(String name)
{
String n = name;
}

ansver
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 11:00, paigesyring
How does a policy manual an organization? a. it boost productivity. b. it create awareness in employees about the organization’s values. c. it employees achieve targets. d. it safeguards the organization from liabilities.
Answers: 1
image
Computers and Technology, 23.06.2019 00:30, hannahrasco4051
Pl i need the answer now ! which one of the following is considered a peripheral? a software b mouse c usb connector d motherboard
Answers: 1
image
Computers and Technology, 23.06.2019 09:30, GEEKLIFE6598
After you present a proposal, the committee starts asking you questions, some beyond the strict focus of your proposal. they ask questions about implications in other fields and knowledge about other fields. you are asked to redo your proposal. what is most likely missing? breadth of material depth of material clarity of material details of material
Answers: 1
image
Computers and Technology, 23.06.2019 18:00, bubbles173883
While inserting images, the picture command is usually used to insert photos from a digital camera, and the clip art command is usually used to a. edit the sizes and other characteristics of photos that have been inserted. b. take a screenshot of an image and copy it to the clipboard for pasting. c. search for drawings or other images from a library of prepared pictures. d. make illustrations using lines and shapes that are easy to manipulate.
Answers: 1
You know the right answer?
Consider the following class definition.

public class Person {
private String na...

Questions in other subjects: