Consider the following class declarations.
public class Tree
{
private String treeVarie...
Computers and Technology, 02.04.2021 17:50, jtoole5341
Consider the following class declarations.
public class Tree
{
private String treeVariety;
public Tree()
{
treeVariety = "Oak";
}
public Tree(String variety)
{
treeVariety = variety;
}
}
public class DeciduousTree extends Tree
{
public DeciduousTree(String variety)
{
super();
}
}
public class EvergreenTree extends Tree
{
public EvergreenTree(String variety)
{
super(variety);
}
}
The following code segment appears in a method in another class.
DeciduousTree tree1 = new DeciduousTree("Maple");
EvergreenTree tree2 = new EvergreenTree("Fir");
Which of the following best describes the result of executing the code segment?
A: Object tree1 is created using the DeciduousTree constructor, which uses super to set tree1’s treeVariety attribute to "Maple". Object tree2 is created using the EvergreenTree constructor, which uses super to set tree2’s treeVariety attribute to "Fir".
B: Object tree1 is created using the DeciduousTree constructor, which uses super to set tree1’s treeVariety attribute to "Oak". Object tree2 is created using the EvergreenTree constructor, which uses super to set tree2’s treeVariety attribute to "Fir".
C: Object tree1 is created using the DeciduousTree constructor, which uses super to set tree1’s treeVariety attribute to "Oak". Object tree2 is created using the EvergreenTree constructor, which uses super to set tree2’s treeVariety attribute to "Oak".
D: The code segment does not compile because the DeciduousTree and EvergreenTree constructors should not take a parameter.
E: The code segment does not compile because the DeciduousTree and EvergreenTree constructors do not correctly call a Tree constructor.
Answers: 3
Computers and Technology, 22.06.2019 12:40, Rententen3845
How do i get the most points, without any effort?
Answers: 2
Computers and Technology, 23.06.2019 12:40, Emilyvite6251
According to the video what are some tasks petroleum engineers perform check all that apply
Answers: 2
Computers and Technology, 24.06.2019 07:40, daebreonnakelly
What type of multimedia are live news feeds? live news feeds are examples of multimedia.
Answers: 2
Mathematics, 12.03.2021 19:50
Mathematics, 12.03.2021 19:50
Biology, 12.03.2021 19:50
English, 12.03.2021 19:50
Mathematics, 12.03.2021 19:50
Mathematics, 12.03.2021 19:50