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, 23.06.2019 15:00
Plz ( which is an example of a good url?
Answers: 1
question
Computers and Technology, 24.06.2019 08:30
Aconsumer would pay an extra they used the rent to own program to buy the computer, rather than using cash. for all of the items, is the cheapest option over the life of the contract. the most expensive overall option is to use purchase the item.
Answers: 2
question
Computers and Technology, 24.06.2019 14:30
Ahousehold consists of a married couple and their twin five-year old daughters. the couples children had no income and lived with their parents all of last year. how many exemptions can the couple claim on last years tax return or they file with the “ married filing jointly “ status? a. 4 b. 5 c. 3 d. 2
Answers: 1
question
Computers and Technology, 24.06.2019 18:20
The following if statement contains a logic error, not a syntax error. rewrite it so that it is correct. assume the variable age already exists and holds a valid number. if (age == 18 & & age == 19) {
Answers: 1
You know the right answer?
Questions 2 – 4 refer to the following classes:
public class Thing {
private int value;<...
Questions
question
Geography, 20.09.2020 17:01
Questions on the website: 13722360