subject

Consider the following class definitions. public class Robot

{

private int servoCount;

public int getServoCount()

{

return servoCount;

}

public void setServoCount(int in)

{

servoCount = in;

}

}

public class Android extends Robot

{

private int servoCount;

public Android(int initVal)

{

setServoCount(initVal);

}

public int getServoCount()

{

return super. getServoCount();

}

public int getLocal()

{

return servoCount;

}

public void setServoCount(int in)

{

super. setServoCount(in);

}

public void setLocal(int in)

{

servoCount = in;

}

}

The following code segment appears in a method in another class.

int x = 10;

int y = 20;

/* missing code */

Which of the following code segments can be used to replace /* missing code */ so that the value 20 will be printed?

A Android a = new Android(x);

a. setServoCount(y);

System. out. println(a. getServoCount());

B Android a = new Android(x);

a. setServoCount(y);

System. out. println(a. getLocal());

C Android a = new Android(x);

a. setLocal(y);

System. out. println(a. getServoCount());

D Android a = new Android(y);

a. setServoCount(x);

System. out. println(a. getLocal());

E Android a = new Android(y);

a. setLocal(x);

System. out. println(a. getLocal());

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 06:00
Which statistical function in a spreadsheet you to see how far each number varies, on average, from the average value of the list?
Answers: 2
question
Computers and Technology, 24.06.2019 02:30
Which option completes the explanation for conflict of interest in an organization
Answers: 1
question
Computers and Technology, 24.06.2019 15:00
Universal windows platform is designed for which windows 10 version?
Answers: 1
question
Computers and Technology, 24.06.2019 15:30
What is the total number of time zones that can be configured to show by default in a calendar in outlook 2016?
Answers: 1
You know the right answer?
Consider the following class definitions. public class Robot

{

private in...
Questions
question
Mathematics, 16.11.2020 17:50
question
History, 16.11.2020 17:50
question
History, 16.11.2020 17:50
Questions on the website: 13722363