subject

Public class Road {
private String roadName;
public Road(String name)
{
roadName = name;
}
}
public class Highway extends Road
{
private int speedLimit;
public Highway(String name, int limit)
{
super(name);
speedLimit = limit;
}
}
The following code segment appears in a method in another class.
Road r1 = new Highway("Interstate 101", 55); // line 1
Road r2 = new Road("Elm Street"); // line 2
Highway r3 = new Road("Sullivan Street"); // line 3
Highway r4 = new Highway("New Jersey Turnpike", 65); // line 4
Which of the following best explains the error, if any, in the code segment?
A) Line 1 will cause an error because a Road variable cannot be instantiated as an object of type Highway.
B) Line 2 will cause an error because the Road constructor is not properly called.
C) Line 3 will cause an error because a Highway variable cannot be instantiated as an object of type Road.
D) Line 4 will cause an error because the Highway constructor is not properly called.
E) The code segment compiles and runs without error.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 22:00
Business professionals of america, and future business leaders of america – phi beta lambda are both open to business students at which levels? check all that apply. elementary school middle school high school college
Answers: 1
question
Computers and Technology, 23.06.2019 04:10
2pointswho was mikhail gorbachev? oa. a russian leader who opposed a coupob. a polish leader who founded the labor union "solidarityoc. a soviet leader who called for a closer relationship with the unitedstates, economic reform, and a more open societyd. a soviet leader who called for more oppression in the soviet union
Answers: 3
question
Computers and Technology, 23.06.2019 09:30
After you present a proposal, the committee starts asking you questions, some beyond the strict focus of your proposal. they ask questions about implications in other fields and knowledge about other fields. you are asked to redo your proposal. what is most likely missing? breadth of material depth of material clarity of material details of material
Answers: 1
question
Computers and Technology, 24.06.2019 00:50
Which of the following is not a key player in the sale of travel products?
Answers: 2
You know the right answer?
Public class Road {
private String roadName;
public Road(String name)
{
ro...
Questions
question
Mathematics, 13.01.2020 20:31
Questions on the website: 13722363