subject

Consider the following classes:

public class First {
public void method2() {
System. out. println("First2");
}

public void method3() {
method2();
}
}

public class Second extends First {
public void method2() {
System. out. println("Second2");
}
}

public class Third extends Second {
public void method1() {
System. out. println("Third1");
super. method2();
}

public void method2() {
System. out. println("Third2");
}
}

public class Fourth extends First {
public void method1() {
System. out. println("Fourth1");
}

public void method2() {
System. out. println("Fourth2");
}
}
Suppose the following variables are defined:

First var1 = new Second();
First var2 = new Third();
First var3 = new Fourth();
Second var4 = new Third();
Object var5 = new Fourth();
Object var6 = new Second();

Indicate below the output that would be produced by each statement shown. If the statement produces more than one line of output, indicate the line breaks with slashes as in a/b/c to indicate three lines of output with a followed by b followed by c. If the statement causes an error, write the word error to indicate this.

var1.method2();
var2.method2();
var3.method2();
var4.method2();
var5.method2();
var6.method2();
var1.method3();
var2.method3();
var3.method3();
var4.method3();
var5.method3();
var6.method3();
((Second) var4).method1();
((Third) var4).method1();
((Second) var5).method2();
((First) var5).method3();
((Third) var5).method1();
((First) var6).method3();
((Second) var6).method1();
((Second) var6).method3();

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 15:30
1. ask the user how many questions are in the quiz. 2. ask the user to enter the key (that is, the correct answers). there should be one answer for each question in the quiz, and each answer should be an integer. e.g., 34 7 13 100 81 3 9 10 321 12 might be the key for a 10-question quiz. you will need to store the key in an array. 3. ask the user to enter the answers for the quiz to be graded. there needs to be one answer for each question. note that these answers do not need to be stored; each answer can simply be compared to the key as it is entered. 4. when the user has entered all of the answers to be graded, print the number correct and the percent correct. 5. add a loop so that the user can grade any number of quizzes with a single key. after the results have been printed for each quiz, ask "grade another quiz? (y/n)." note: you only have one array (the key). you are not creating a new key for each set of quiz answers.
Answers: 3
question
Computers and Technology, 24.06.2019 05:30
How do i get rid of my member ship for
Answers: 2
question
Computers and Technology, 24.06.2019 16:00
Your is an example of personal information that you should keep private.
Answers: 1
question
Computers and Technology, 25.06.2019 09:30
1. write a statement that declares a string variable named city. the variable should be initialized so it references an object with the string “san francisco”. a) assume that stringlength is an int variable. write a statement that stores the length of the string referenced by the city variable (declared in question1) in stringlength. b) assume that onechar is a char variable. write a statement that stores the first char- acter in the string referenced by the city variable (declared in question1) in onechar. c) assume that uppercity is a string reference variable. write a statement that stores the uppercase equivalent of the string referenced by the city variable (declared in question 1) in uppercity. d) assume that lowercity is a string reference variable. write a statement that stores the lowercase equivalent of the string referenced by the city variable (declared in question 1) in lowercity.
Answers: 3
You know the right answer?
Consider the following classes:

public class First {
public void method2() {
...
Questions
question
Mathematics, 07.06.2020 16:57
question
Mathematics, 07.06.2020 16:57
question
Physics, 07.06.2020 17:57
Questions on the website: 13722363