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

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 00:30
Advantages and disadvantages of binary system
Answers: 1
question
Computers and Technology, 23.06.2019 11:00
Sports and entertainment class, your goal is to increase attendance and make a profit for a game by getting your team on a winning track with total salaries less than $3,000,000
Answers: 3
question
Computers and Technology, 23.06.2019 12:30
What is the difference between the internet and the world wide web?
Answers: 1
question
Computers and Technology, 23.06.2019 20:30
1. for which of the following are you not required to signal beforehand? a. changing lanes b. speeding up c. stopping
Answers: 2
You know the right answer?
Consider the following class definition.

public class Person {
private String na...
Questions
question
Biology, 05.02.2020 11:55
question
Mathematics, 05.02.2020 11:55
question
Mathematics, 05.02.2020 11:55
question
Social Studies, 05.02.2020 11:55