subject
Computers and Technology, 20.03.2020 18:11 jahzz

Questions 2 – 4 refer to the following classes:
public class Thing {
private int value;

public Thing() {
value = (int)(Math. random () * 100);
}

public String toString() {
return "" + value;
}

// other methods not shown
}
public class Cog extends Thing {
private int num;

public Cog () {
num = (int)(Math. random () * 100);
}

public String toString() {
return "" + num;
}
}

Consider the following declaration:
public class Gear extends Cog
Which of the following is true?

Gear cannot extend Cog since classes can only inherit from one class.
Gear can access all variables in both Cog and Thing.
Gear cannot access any methods in Thing.
Gear's constructor calls the constructor in Cog and Thing.
Gear's constructor calls the constructor in Cog, which calls the constructor in Thing.

Which of the following is NOT true?

Cog cannot directly access the variable value in Thing.
Cog can call the constructor in Thing directly using the super keyword.
The constructor in Cog automatically calls the constructor in Thing.
Cog can call the toString method in Thing.
Thing can call the toString method in Cog.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 17:00
Your computer running windows 10 is doing some very strange things with the operating system. you are fairly certain it is not a hardware issue. you need to try to get further insight into what is going on within the operating system. which tool would be best suited for this?
Answers: 2
question
Computers and Technology, 23.06.2019 15:00
What is the total resistance in a circuit that contains three 60 ohm resistors connected in a series? a. 20 ohms b. 120 ohms c. 60 ohms d. 180 ohms
Answers: 2
question
Computers and Technology, 24.06.2019 01:00
How can the temperature of a room be raised by 5degreesf?
Answers: 1
question
Computers and Technology, 24.06.2019 04:30
Fall protection, confined space entry procedures, controlled noise levels, and protection from chemical hazards are some of the things that contribute to a safe what
Answers: 1
You know the right answer?
Questions 2 – 4 refer to the following classes:
public class Thing {
private int value;<...
Questions
question
Mathematics, 23.04.2020 18:06
question
Biology, 23.04.2020 18:06