subject

Consider the definition of the Person class below. The class uses the instance variable adult to indicate whether a person is an adult or not. public class Person
{
private String name;
private int age;
private boolean adult;
public Person (String n, int a)
{

name = n;
age = a;
if (age >= 18)
{
adult = true;
}
else
{
adult = false;
}
}
}

Which of the following statements will create a Person object that represents an adult person?

a. Person p = new Person ("Homer", "adult");
b. Person p = new Person ("Homer", 23);
c. Person p = new Person ("Homer", "23");
d. Person p = new Person ("Homer", true);
e. Person p = new Person ("Homer", 17);

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 22:00
3. (6 pts) internally in the computer, with few exceptions, all numerical computation is done using binary numbers. output, however, often uses ascii, which is formed by appending 011 to the left of a bcd code. thus, an algorithm that directly converts a binary integer to a bcd integer is very useful. here is one such algorithm 1) draw lines to the left of the binary number to bound the expected bcd decades. (each decade is a group of 4 bits.) move the binary number one bit to the left. add 0011 to each bcd decade containing a binary value> 0100 repeat steps 2-3 until the last bit in the binary number has been moved into the least significant decade position. (note that when the last bit has been shifted into bcd decade, step 3 is not repeated.) read the bcd result. 2) 3) 4) 5) a) execute the algorithm for the binary number 1101101 b) execute the algorithm for the binary number 01110101110 4. (4 pts) represent the decimal number 3568 in bcd; excess-3 code; ascil; and hex.
Answers: 1
question
Computers and Technology, 22.06.2019 21:30
Im doing this last minute and literally none of my neighbors or people that my dad works with use excel so if anyone could me make up an example
Answers: 1
question
Computers and Technology, 23.06.2019 06:30
Martha is designing a single-player game. her manager suggests that she plan the design to incorporate future modifications. which principle of game design relates to planning for future modifications?
Answers: 1
question
Computers and Technology, 25.06.2019 07:50
Identify an advantage of centralized processing
Answers: 1
You know the right answer?
Consider the definition of the Person class below. The class uses the instance variable adult to ind...
Questions
question
Mathematics, 26.03.2021 19:50
question
Mathematics, 26.03.2021 19:50
question
Mathematics, 26.03.2021 19:50
question
History, 26.03.2021 19:50
question
Mathematics, 26.03.2021 19:50
question
Mathematics, 26.03.2021 19:50
Questions on the website: 13722367