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:00
To check whether your writing is clear , you can
Answers: 2
question
Computers and Technology, 23.06.2019 21:00
Will this setup result in what kathy wants to print?
Answers: 2
question
Computers and Technology, 25.06.2019 05:30
In 3-5 sentences describe how technology business professionals to be more efficient. include examples of hardware and software
Answers: 1
question
Computers and Technology, 26.06.2019 03:20
Summarize the following range of ip addresses by ensuring that the summaries do not include any unnecessary addresses. explain clearly how you arrive at the solution showing all relevant steps 172.47.30.0/24 172.47.31.0/24 172.47.32.0/24 172.47.33.0/24 172.47.34.0/24 172.47.35.0/24 172.47.36.0/24
Answers: 3
You know the right answer?
Consider the following classes:

public class First {
public void method2() {
...
Questions
question
Mathematics, 20.08.2019 20:00
question
Mathematics, 20.08.2019 20:00
Questions on the website: 13722361