Services
Discover
Ask a Question
Log in
Sign up
Filters
Done
Question type:
Essay
Multiple Choice
Short Answer
True False
Matching
Topic
Computing
Study Set
Big Java Binder Early Objects
Exam 9: Inheritance
Path 4
Access For Free
Share
All types
Filters
Study Flashcards
Practice Exam
Learn
Question 21
Multiple Choice
Consider the following code snippet: public class Employee { ) . . Public void setDepartment(String deptName) { ) . . } } Public class Programmer extends Employee { ) . . Public void setProjectName(String projName) { ) . . } Public void setDepartment(String deptName) { ) . . } } Which of the following statements is NOT correct?
Question 22
Multiple Choice
Consider the following code snippet: public class Motorcycle extends Vehicle { ) . . Public Motorcycle(int numberAxles) { Super.numberAxles; } } What does this code do?
Question 23
Multiple Choice
You are creating a Motorcycle class that is supposed to be a subclass of the Vehicle class. Which of the following class declaration statements will accomplish this?
Question 24
Multiple Choice
To override a superclass method in a subclass, the subclass method ____.
Question 25
Multiple Choice
Consider the following code snippet: public class Vehicle { Protected int numberAxles; ) . . } Data in the numberAxles variable can be accessed by ____.
Question 26
Multiple Choice
Which of the following is true regarding subclasses?
Question 27
Multiple Choice
Which of the following statements about abstract methods is true?
Question 28
Multiple Choice
Consider the following code snippet: public class Motorcycle extends Vehicle { ) . . Public Motorcycle(int numberAxles) { Super(numberAxles) ; //line #1 } } If the line marked "//line #1" was missing, which of these statements would be correct?
Question 29
Multiple Choice
Consider the following code snippet: public class Coin { Private String name; ) . . Public boolean equals(Object otherCoin) { Return name.equals(otherCoin.name) ; } ) . . } What is wrong with this code?
Question 30
Multiple Choice
You are creating a Motorcycle class which is supposed to be a subclass of the Vehicle class. Which of the following class declaration statements will accomplish this?
Question 31
Multiple Choice
Which of the following statements about comparing objects is correct?
Question 32
Multiple Choice
Consider the following code snippet of a function object public interface Measurer { Double measure(______ anObject) ; } Complete this code to allow the interface to handle all classes?
Question 33
Multiple Choice
When declared as protected, data in an object can be accessed by ____.
Question 34
Multiple Choice
All hamsters are rodents and all rodents are mammals. What hierarchy best captures this information?
Question 35
Multiple Choice
Consider the classes shown below: public class Parent { Public void doSomething() {/* Implementation not shown */} } Public class Child extends Parent { Public void doAnotherThing() {/* Implementation not shown */} } Which lines in the following code will compile without error? Parent kid = new Child() ; Kid) doSomething() ; // line 1 Kid) doAnotherThing() ; // line 2
Question 36
Multiple Choice
Consider the following code snippet: public abstract class Employee { Public abstract void setSalary() ; ) . . } You wish to create a concrete subclass named Programmer. Which of the following is the correct way to declare this subclass?