chapter 10 java

Ace your homework & exams now with Quizwiz!

Which of the following statements declares Salaried as a subclass PayType?

public class Salaried extends PayType

If a superclass does not have a default constructor or a no-arg constuctor;

then a class that inherits from it, must call one of the constructors that the superclass does have

what will the the call to super do?

It will call the constructor of ClassA that receives an integer as an argument.

If a subclass constructor does not explicitly call a superclass constructor:

Java will automatically call the superclass's default or no-arg constructor just before the code in subclass's constructor executes

protected members are:

both A and B

When one object is a specialized version of another object, there is this type of relationship between them

is a

look at the following code. Which line has an error?

line 5 }

A protected member of a class may be directly accessed by

methods of the same class methods of a subclass methods in the same package

protected class members are denoted in a UML diagram with the symbol

#

When a subclass overloads a superclass method:

Both methods may be called with a subclass object

In the following statement, which is the superclass? public class ClassA extends ClassB implements ClassC

ClassB

Given the following code which of the following is true public class ClassB implements ClassA{ }

ClassB must override each method in ClassA

replacing inadequate superclass methods with more suitable subclass methods is known as what?

Method overloading

In an inheritance relationship:

The superclass constructor always executes before the subclass constructor

In the UML diagrams, inheritance is shown:

With a line that has a open arrowhead at one end that points to the superclass

If ClassC extents ClassB, which extends ClassA, this would be an example of

a chain of inheritance

If a class contains an abstract method:

all above

When an "is a" relationship exists between objects, it means that the specialized object has

all the characteristics of the general object, plus additional characteristics

All fields declared in an interface

are Final and Static

a subclass can directly access:

only public and protected members of the superclass

If two methods have the same name but different signatures, they are:

overloaded

If you do not provide an access specifier for a class member, the class member is given _____ by default:

package

A subclass may call an overridden superclass method by:

prefixing its name with the super keyword and a ( . )

When declaring class data members, it is best to declare them as:

private members

What keyword can you use to call a superclass constructor explicitly ?

super

The super statement that calls the superclass constructor:

must be the first statement in the subclass's constructor

If ClassA extends ClassB, then

public members in ClassB are public in ClassA, but private members in ClassB cannot be directly accessed in ClassA

When a method is declared with the _________ modifier, it cannot be overridden in a subclass

final


Related study sets

First 30 Elements & their Symbols

View Set

Chemistry Test 4- Evidence of Chemical Reactions 1

View Set

5203 - Chap. 6 - Reading Comprehension Strategies for Children

View Set

INS 3103 Risk Management and Insurance FINAL (Rejda)

View Set

CHAPTER 18- Taxes Affecting Real Estate

View Set

Quiz 6: Routing Protocols (Chapter 10)

View Set