Deck 11: Advanced Inheritance Concepts

ملء الشاشة (f)
exit full mode
سؤال
Classes from which objects can be instantiated are called constant classes.
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
When you assign a variable or constant of one type to a variable of another type, the behavior is called ____.

A) implicit conversion
B) referencing
C) dynamic method binding
D) containing
سؤال
When you define a class, if you do not explicitly extend another class, your class is an extension of the ____ class.

A) Object
B) super
C) public
D) abstract
سؤال
An application's ability to select the correct subclass method is known as ____.

A) implementing methods
B) dynamic method binding
C) implicit casting
D) method fixing
سؤال
If you create an empty method within an abstract class, the method is abstract even if you do not explicitly use the keyword abstract.
سؤال
You sometimes create an abstract class only so you can ____ it to another class.

A) link
B) copy
C) extend
D) abstract
سؤال
Abstract classes and interfaces are similar in that you cannot instantiate concrete objects from either one.
سؤال
When you create a superclass and one or more subclasses, each object of each subclass is a subclass object.
سؤال
A(n) ____ class is a class that you create only to extend from.

A) abstract
B) inheritance
C) parent
D) final
سؤال
The Object class ____ method converts an Object into a String that contains information about the Object .

A) equals()
B) setType()
C) toString()
D) speak()
سؤال
The java.lang package contains fundamental classes and is imported automatically each time a program is written.
سؤال
A(n) ____ is not an object, but it points to a memory address.

A) abstract class
B) reference
C) extend
D) interface
سؤال
A class that will be placed in a nondefault package for others to use must be private .
سؤال
If you attempt to instantiate an object from an abstract class, you receive an error message from the compiler that you have committed a(n) ____.

A) LogicError
B) InstantiationError
C) SyntaxError
D) ObjectError
سؤال
When you create a class that uses an interface, you include the keyword extends .
سؤال
Instead of using the automatic toString() method with your classes, it is usually more useful to write your own ____ version of the toString() method that displays some or all of the data field values for the object with which you use it.

A) overloaded
B) protected
C) static
D) condensed
سؤال
While a class can inherit from multiple abstract superclasses, it implement only one interface.
سؤال
It is common to create an interface when you want a class to implement behavior from more than one parent.
سؤال
Which of the following statements creates an array of three Animal references?

A) Animal[] ref = new Animal(3);
B) Animal[] new = ref Animal[3];
C) Animal[] animalRef = new Animal[3];
D) Animal[] ref = extend Animal[3];
سؤال
Java does not allow a class to inherit directly from two or more parents.
سؤال
When you show abstract classes and methods in class diagrams, their names appear in ____.

A) bold
B) all caps
C) italics
D) blue
سؤال
When you create a new subclass in Java, neither the superclass source code nor the superclass ____ is changed.

A) bytecode
B) object
C) argument
D) possession
سؤال
Classes, such as the String class, have their own equals() methods that overload the ____ class method.

A) Object
B) Public
C) Abstract
D) Child
سؤال
Which of the following is NOT true regarding abstract methods?

A) Abstract methods must be implemented in child classes.
B) Abstract methods have no body.
C) Abstract methods use the abstract keyword in declarations.
D) Abstract methods are inherited by their children.
سؤال
When you create a class and use the implements clause to implement an interface but fail to code one of the interface's methods, the compiler error generated indicates that you must declare your class to be ____.

A) abstract
B) static
C) public
D) related
سؤال
If Java did not allow you to ____ classes, you would need to create every part of a program from scratch.

A) extend
B) override
C) abstract
D) import
سؤال
The Object class equals() method returns a boolean value indicating whether the objects are equal. This equals() method considers two objects to be equal only if they have the same ____________________ .
سؤال
If you provide an empty method within an abstract class, the method is an abstract method even if you do not explicitly use the keyword ____________________ when defining the method.
سؤال
A(n) ____ looks much like a class, except that all of its methods (if any) are implicitly public and abstract.

A) hash code
B) package
C) collision
D) interface
سؤال
If you do not specify a package for a class, it is placed in an unnamed ____ package.

A) system
B) language
C) default
D) general
سؤال
____ compress the data they store, which reduces the size of archived class files.

A) Dynamic method bindings
B) JAR files
C) Type-import-on-demand declarations
D) Interfaces
سؤال
When you create a number of classes that inherit from each other, as well as multiple interfaces that you want to implement with these classes, you often will find it convenient to place these related classes in a(n) ____________________.
سؤال
The Object class equals() method returns a(n) ____ value indicating whether the objects are equal.

A) int
B) equals
C) null
D) boolean
سؤال
In other programming languages, such as C++, abstract classes are known as ____________________ classes.
سؤال
The capability to inherit from more than one class is called ____.

A) multiple inheritance
B) collision
C) polyinheritance
D) dynamic method binding
سؤال
In the Java programming language, a package or class library is often delivered to users as a(n) ____________________ file.
سؤال
The ____ method is useful in debugging a program because it can be used to display and examine values.

A) finalize()
B) toString()
C) notify()
D) equals()
سؤال
Java's Object class contains a public method named ____ that returns an integer representing the hash code.

A) length()
B) hashCode()
C) hcode()
D) toString()
سؤال
____ is a calculated number that is used to uniquely identify an object.

A) Method binding
B) A hash code
C) Implicit conversion
D) Ad-hoc polymorphism
سؤال
When a class both extends and implements, by convention the ____ clause follows the extends clause in the class header.

A) extends
B) new
C) implements
D) if
سؤال
Match between columns
Data fields in an interface
virtual classes
Data fields in an interface
dynamic method binding
Data fields in an interface
java.lang
Data fields in an interface
equals() method
Data fields in an interface
collision
Data fields in an interface
interface
Data fields in an interface
multiple inheritance
Data fields in an interface
public , static , and final
Data fields in an interface
nonabstract method
A class-naming conflict
virtual classes
A class-naming conflict
dynamic method binding
A class-naming conflict
java.lang
A class-naming conflict
equals() method
A class-naming conflict
collision
A class-naming conflict
interface
A class-naming conflict
multiple inheritance
A class-naming conflict
public , static , and final
A class-naming conflict
nonabstract method
A method that is inherited
virtual classes
A method that is inherited
dynamic method binding
A method that is inherited
java.lang
A method that is inherited
equals() method
A method that is inherited
collision
A method that is inherited
interface
A method that is inherited
multiple inheritance
A method that is inherited
public , static , and final
A method that is inherited
nonabstract method
An alternative to multiple inheritance available in Java
virtual classes
An alternative to multiple inheritance available in Java
dynamic method binding
An alternative to multiple inheritance available in Java
java.lang
An alternative to multiple inheritance available in Java
equals() method
An alternative to multiple inheritance available in Java
collision
An alternative to multiple inheritance available in Java
interface
An alternative to multiple inheritance available in Java
multiple inheritance
An alternative to multiple inheritance available in Java
public , static , and final
An alternative to multiple inheritance available in Java
nonabstract method
Considers two objects of the same class to be equal only if they have the same hash code
virtual classes
Considers two objects of the same class to be equal only if they have the same hash code
dynamic method binding
Considers two objects of the same class to be equal only if they have the same hash code
java.lang
Considers two objects of the same class to be equal only if they have the same hash code
equals() method
Considers two objects of the same class to be equal only if they have the same hash code
collision
Considers two objects of the same class to be equal only if they have the same hash code
interface
Considers two objects of the same class to be equal only if they have the same hash code
multiple inheritance
Considers two objects of the same class to be equal only if they have the same hash code
public , static , and final
Considers two objects of the same class to be equal only if they have the same hash code
nonabstract method
The correct subclass method is attached to the application
virtual classes
The correct subclass method is attached to the application
dynamic method binding
The correct subclass method is attached to the application
java.lang
The correct subclass method is attached to the application
equals() method
The correct subclass method is attached to the application
collision
The correct subclass method is attached to the application
interface
The correct subclass method is attached to the application
multiple inheritance
The correct subclass method is attached to the application
public , static , and final
The correct subclass method is attached to the application
nonabstract method
Prohibited in Java
virtual classes
Prohibited in Java
dynamic method binding
Prohibited in Java
java.lang
Prohibited in Java
equals() method
Prohibited in Java
collision
Prohibited in Java
interface
Prohibited in Java
multiple inheritance
Prohibited in Java
public , static , and final
Prohibited in Java
nonabstract method
Contains the Object class
virtual classes
Contains the Object class
dynamic method binding
Contains the Object class
java.lang
Contains the Object class
equals() method
Contains the Object class
collision
Contains the Object class
interface
Contains the Object class
multiple inheritance
Contains the Object class
public , static , and final
Contains the Object class
nonabstract method
The name given to abstract classes in other programming languages, such as C++
virtual classes
The name given to abstract classes in other programming languages, such as C++
dynamic method binding
The name given to abstract classes in other programming languages, such as C++
java.lang
The name given to abstract classes in other programming languages, such as C++
equals() method
The name given to abstract classes in other programming languages, such as C++
collision
The name given to abstract classes in other programming languages, such as C++
interface
The name given to abstract classes in other programming languages, such as C++
multiple inheritance
The name given to abstract classes in other programming languages, such as C++
public , static , and final
The name given to abstract classes in other programming languages, such as C++
nonabstract method
سؤال
public interface FindTheError
{
    void firstMethod(int anIntNum)
   {
        System.out.println("Did you find the error?");
   }
}
What is the problem with the above interface? How would you correct the interface?
سؤال
Why do many programmers consider multiple inheritance to be a difficult concept?
سؤال
public class CarReference
{
    public static void main(String[] args)
    {
       Car carRef;
       ----Code here---
       carRef.color();
    }
}
Suppose you have created a Car class and Honda and Ford subclasses. Using the above code, complete the indicated statement to create a new Honda object that is assigned to the Car reference.
سؤال
When you create classes for others to use, why would you not want to provide the users with your source code in the files with .java extensions?
سؤال
Describe the two method types programmers of an abstract class can include.
سؤال
When a superclass is abstract, you cannot instantiate objects of a superclass. How can you use a superclass abstract object?
سؤال
Compare and contrast abstract classes and interfaces.
سؤال
    The equals() method returns a boolean value indicating whether two objects are equal. Using the above code, will the two BankAccount objects be equal? Explain why or why not.<div style=padding-top: 35px>
    The equals() method returns a boolean value indicating whether two objects are equal. Using the above code, will the two BankAccount objects be equal? Explain why or why not.<div style=padding-top: 35px>
The equals() method returns a boolean value indicating whether two objects are equal. Using the above code, will the two BankAccount objects be equal? Explain why or why not.
سؤال
public class Animal
{
}
public class Animal extends Object
{
}
The two class declarations above have identical outcomes. Explains why this is the case.
سؤال
What is the toString() method used for and how is it used?
سؤال
What is an abstract class? Give an example and explain how it works.
سؤال
How is the Object class equals() method implemented?
سؤال
Give an example of how you can create an interface to have a class implement behavior from more than one parent.
سؤال
What are the advantages to creating a useful, extendable superclass?
سؤال
What is dynamic method binding and why is it used?
سؤال
  The AnimalReference application shown above contains a generic Animal reference variable into which you can assign concrete Animal objects. Explain how this example uses polymorphism and why it is important.<div style=padding-top: 35px>
The AnimalReference application shown above contains a generic Animal reference variable into which you can assign concrete Animal objects. Explain how this example uses polymorphism and why it is important.
سؤال
public abstract class Car
{
    private String model;
    public abstract void color();
    public String getName()
    {
        return model;
     }
     public void setName(String carModel)
     {
        model = carModel;
      }
}
Using the code above, would it be possible to create a class in which you declare a Car object with the statement Car myCar = new Car("Honda"); ?
Explain why or why not.
سؤال
public abstract class Car
{
    private String model;
    public abstract void color();
    public String getModel()
    {
         return model;
     }
    public void setModel(String modelName)
    {
         model = modelName;
     }
}
public class Honda extends Car
{
    public void color()
    {
System.out.println("red");
    }
}
public class Ford extends Car
{
    public void color()
    {
      System.out.println("blue");
    }
}
public class MyCars
{
    public static void main(String[] args)
    {
       Honda myHonda = new Honda();
       Ford myFord = new Ford();
  myHonda.setModel("My Honda is ");
       myFord.setModel("My Ford is ");
  System.out.print(myHonda.getModel());
  myHonda.color();
  System.out.print(myFord.getModel());
  myFord.color();
    }
}
In the above code, the myHonda.getModel() and myHonda.color() method calls produce different output from when the same methods are used with myFord . Explain why this is the case.
سؤال
When you create a useful, extendable superclass, you and other future programmers gain what advantages?
سؤال
  An array can be created to reserve space for references to objects. Using the code above, explain how an array of superclass references can hold subclass references.<div style=padding-top: 35px>
An array can be created to reserve space for references to objects. Using the code above, explain how an array of superclass references can hold subclass references.
سؤال
  The shaded header of the talkingAnimal() method accepts any type of Animal argument. Explain how this is possible.<div style=padding-top: 35px>
The shaded header of the talkingAnimal() method accepts any type of Animal argument. Explain how this is possible.
سؤال
public abstract class Car
{
    private String model;
    public abstract void color();
    public String getModel()
    {
         return model;
    }
    public void setModel(String modelName)
    {
         model = modelName;
    }
}
public class Honda extends Car
{
    public void color()
    {
       System.out.println("red");
    }
}
public class Ford extends Car
{
    public void color()
    {
      System.out.println("blue");
    }
}
public class MyCars
{
    public static void main(String[] args)
    {
       Honda myHonda = new Honda();
       Ford myFord = new Ford();
       myHonda.setModel("My Honda is ");
       myFord.setModel("My Ford is ");
       System.out.print(myHonda.getModel());
       myHonda.color();
       System.out.print(myFord.getModel());
       myFord.color();
    }
}
Using the above code, describe the output that will appear when the program is executed.
سؤال
public abstract class Car
{
    private String model;
    public abstract void color();
    public String getModel()
    {
         return model;
    }
    public void setModel(String modelName)
    {
         model = modelName;
    }
}
The above code creates a generic abstract class named Car with an abstract color() method. Using the code below, fill in the indicated statements in order to create a Honda class that extends Car .
public class --Code here-- extends --Code here--
{
    public void --Code here--
    {
       System.out.println("I like your red car!");
    }
}
سؤال
    The code above provides an example of an interface class. Explain the purpose and advantages of creating interfaces that store related constants.<div style=padding-top: 35px>
    The code above provides an example of an interface class. Explain the purpose and advantages of creating interfaces that store related constants.<div style=padding-top: 35px>
The code above provides an example of an interface class. Explain the purpose and advantages of creating interfaces that store related constants.
سؤال
public abstract class Shape
{
    private int length;
    private int width;
    private int height;
    ----Code here----
}
Using the above code, create the statement in the place indicated that will create an abstract calculateArea() method in the abstract Shape class.
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/66
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 11: Advanced Inheritance Concepts
1
Classes from which objects can be instantiated are called constant classes.
False
2
When you assign a variable or constant of one type to a variable of another type, the behavior is called ____.

A) implicit conversion
B) referencing
C) dynamic method binding
D) containing
A
3
When you define a class, if you do not explicitly extend another class, your class is an extension of the ____ class.

A) Object
B) super
C) public
D) abstract
A
4
An application's ability to select the correct subclass method is known as ____.

A) implementing methods
B) dynamic method binding
C) implicit casting
D) method fixing
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
5
If you create an empty method within an abstract class, the method is abstract even if you do not explicitly use the keyword abstract.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
6
You sometimes create an abstract class only so you can ____ it to another class.

A) link
B) copy
C) extend
D) abstract
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
7
Abstract classes and interfaces are similar in that you cannot instantiate concrete objects from either one.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
8
When you create a superclass and one or more subclasses, each object of each subclass is a subclass object.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
9
A(n) ____ class is a class that you create only to extend from.

A) abstract
B) inheritance
C) parent
D) final
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
10
The Object class ____ method converts an Object into a String that contains information about the Object .

A) equals()
B) setType()
C) toString()
D) speak()
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
11
The java.lang package contains fundamental classes and is imported automatically each time a program is written.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
12
A(n) ____ is not an object, but it points to a memory address.

A) abstract class
B) reference
C) extend
D) interface
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
13
A class that will be placed in a nondefault package for others to use must be private .
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
14
If you attempt to instantiate an object from an abstract class, you receive an error message from the compiler that you have committed a(n) ____.

A) LogicError
B) InstantiationError
C) SyntaxError
D) ObjectError
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
15
When you create a class that uses an interface, you include the keyword extends .
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
16
Instead of using the automatic toString() method with your classes, it is usually more useful to write your own ____ version of the toString() method that displays some or all of the data field values for the object with which you use it.

A) overloaded
B) protected
C) static
D) condensed
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
17
While a class can inherit from multiple abstract superclasses, it implement only one interface.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
18
It is common to create an interface when you want a class to implement behavior from more than one parent.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
19
Which of the following statements creates an array of three Animal references?

A) Animal[] ref = new Animal(3);
B) Animal[] new = ref Animal[3];
C) Animal[] animalRef = new Animal[3];
D) Animal[] ref = extend Animal[3];
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
20
Java does not allow a class to inherit directly from two or more parents.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
21
When you show abstract classes and methods in class diagrams, their names appear in ____.

A) bold
B) all caps
C) italics
D) blue
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
22
When you create a new subclass in Java, neither the superclass source code nor the superclass ____ is changed.

A) bytecode
B) object
C) argument
D) possession
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
23
Classes, such as the String class, have their own equals() methods that overload the ____ class method.

A) Object
B) Public
C) Abstract
D) Child
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
24
Which of the following is NOT true regarding abstract methods?

A) Abstract methods must be implemented in child classes.
B) Abstract methods have no body.
C) Abstract methods use the abstract keyword in declarations.
D) Abstract methods are inherited by their children.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
25
When you create a class and use the implements clause to implement an interface but fail to code one of the interface's methods, the compiler error generated indicates that you must declare your class to be ____.

A) abstract
B) static
C) public
D) related
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
26
If Java did not allow you to ____ classes, you would need to create every part of a program from scratch.

A) extend
B) override
C) abstract
D) import
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
27
The Object class equals() method returns a boolean value indicating whether the objects are equal. This equals() method considers two objects to be equal only if they have the same ____________________ .
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
28
If you provide an empty method within an abstract class, the method is an abstract method even if you do not explicitly use the keyword ____________________ when defining the method.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
29
A(n) ____ looks much like a class, except that all of its methods (if any) are implicitly public and abstract.

A) hash code
B) package
C) collision
D) interface
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
30
If you do not specify a package for a class, it is placed in an unnamed ____ package.

A) system
B) language
C) default
D) general
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
31
____ compress the data they store, which reduces the size of archived class files.

A) Dynamic method bindings
B) JAR files
C) Type-import-on-demand declarations
D) Interfaces
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
32
When you create a number of classes that inherit from each other, as well as multiple interfaces that you want to implement with these classes, you often will find it convenient to place these related classes in a(n) ____________________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
33
The Object class equals() method returns a(n) ____ value indicating whether the objects are equal.

A) int
B) equals
C) null
D) boolean
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
34
In other programming languages, such as C++, abstract classes are known as ____________________ classes.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
35
The capability to inherit from more than one class is called ____.

A) multiple inheritance
B) collision
C) polyinheritance
D) dynamic method binding
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
36
In the Java programming language, a package or class library is often delivered to users as a(n) ____________________ file.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
37
The ____ method is useful in debugging a program because it can be used to display and examine values.

A) finalize()
B) toString()
C) notify()
D) equals()
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
38
Java's Object class contains a public method named ____ that returns an integer representing the hash code.

A) length()
B) hashCode()
C) hcode()
D) toString()
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
39
____ is a calculated number that is used to uniquely identify an object.

A) Method binding
B) A hash code
C) Implicit conversion
D) Ad-hoc polymorphism
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
40
When a class both extends and implements, by convention the ____ clause follows the extends clause in the class header.

A) extends
B) new
C) implements
D) if
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
41
Match between columns
Data fields in an interface
virtual classes
Data fields in an interface
dynamic method binding
Data fields in an interface
java.lang
Data fields in an interface
equals() method
Data fields in an interface
collision
Data fields in an interface
interface
Data fields in an interface
multiple inheritance
Data fields in an interface
public , static , and final
Data fields in an interface
nonabstract method
A class-naming conflict
virtual classes
A class-naming conflict
dynamic method binding
A class-naming conflict
java.lang
A class-naming conflict
equals() method
A class-naming conflict
collision
A class-naming conflict
interface
A class-naming conflict
multiple inheritance
A class-naming conflict
public , static , and final
A class-naming conflict
nonabstract method
A method that is inherited
virtual classes
A method that is inherited
dynamic method binding
A method that is inherited
java.lang
A method that is inherited
equals() method
A method that is inherited
collision
A method that is inherited
interface
A method that is inherited
multiple inheritance
A method that is inherited
public , static , and final
A method that is inherited
nonabstract method
An alternative to multiple inheritance available in Java
virtual classes
An alternative to multiple inheritance available in Java
dynamic method binding
An alternative to multiple inheritance available in Java
java.lang
An alternative to multiple inheritance available in Java
equals() method
An alternative to multiple inheritance available in Java
collision
An alternative to multiple inheritance available in Java
interface
An alternative to multiple inheritance available in Java
multiple inheritance
An alternative to multiple inheritance available in Java
public , static , and final
An alternative to multiple inheritance available in Java
nonabstract method
Considers two objects of the same class to be equal only if they have the same hash code
virtual classes
Considers two objects of the same class to be equal only if they have the same hash code
dynamic method binding
Considers two objects of the same class to be equal only if they have the same hash code
java.lang
Considers two objects of the same class to be equal only if they have the same hash code
equals() method
Considers two objects of the same class to be equal only if they have the same hash code
collision
Considers two objects of the same class to be equal only if they have the same hash code
interface
Considers two objects of the same class to be equal only if they have the same hash code
multiple inheritance
Considers two objects of the same class to be equal only if they have the same hash code
public , static , and final
Considers two objects of the same class to be equal only if they have the same hash code
nonabstract method
The correct subclass method is attached to the application
virtual classes
The correct subclass method is attached to the application
dynamic method binding
The correct subclass method is attached to the application
java.lang
The correct subclass method is attached to the application
equals() method
The correct subclass method is attached to the application
collision
The correct subclass method is attached to the application
interface
The correct subclass method is attached to the application
multiple inheritance
The correct subclass method is attached to the application
public , static , and final
The correct subclass method is attached to the application
nonabstract method
Prohibited in Java
virtual classes
Prohibited in Java
dynamic method binding
Prohibited in Java
java.lang
Prohibited in Java
equals() method
Prohibited in Java
collision
Prohibited in Java
interface
Prohibited in Java
multiple inheritance
Prohibited in Java
public , static , and final
Prohibited in Java
nonabstract method
Contains the Object class
virtual classes
Contains the Object class
dynamic method binding
Contains the Object class
java.lang
Contains the Object class
equals() method
Contains the Object class
collision
Contains the Object class
interface
Contains the Object class
multiple inheritance
Contains the Object class
public , static , and final
Contains the Object class
nonabstract method
The name given to abstract classes in other programming languages, such as C++
virtual classes
The name given to abstract classes in other programming languages, such as C++
dynamic method binding
The name given to abstract classes in other programming languages, such as C++
java.lang
The name given to abstract classes in other programming languages, such as C++
equals() method
The name given to abstract classes in other programming languages, such as C++
collision
The name given to abstract classes in other programming languages, such as C++
interface
The name given to abstract classes in other programming languages, such as C++
multiple inheritance
The name given to abstract classes in other programming languages, such as C++
public , static , and final
The name given to abstract classes in other programming languages, such as C++
nonabstract method
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
42
public interface FindTheError
{
    void firstMethod(int anIntNum)
   {
        System.out.println("Did you find the error?");
   }
}
What is the problem with the above interface? How would you correct the interface?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
43
Why do many programmers consider multiple inheritance to be a difficult concept?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
44
public class CarReference
{
    public static void main(String[] args)
    {
       Car carRef;
       ----Code here---
       carRef.color();
    }
}
Suppose you have created a Car class and Honda and Ford subclasses. Using the above code, complete the indicated statement to create a new Honda object that is assigned to the Car reference.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
45
When you create classes for others to use, why would you not want to provide the users with your source code in the files with .java extensions?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
46
Describe the two method types programmers of an abstract class can include.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
47
When a superclass is abstract, you cannot instantiate objects of a superclass. How can you use a superclass abstract object?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
48
Compare and contrast abstract classes and interfaces.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
49
    The equals() method returns a boolean value indicating whether two objects are equal. Using the above code, will the two BankAccount objects be equal? Explain why or why not.
    The equals() method returns a boolean value indicating whether two objects are equal. Using the above code, will the two BankAccount objects be equal? Explain why or why not.
The equals() method returns a boolean value indicating whether two objects are equal. Using the above code, will the two BankAccount objects be equal? Explain why or why not.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
50
public class Animal
{
}
public class Animal extends Object
{
}
The two class declarations above have identical outcomes. Explains why this is the case.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
51
What is the toString() method used for and how is it used?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
52
What is an abstract class? Give an example and explain how it works.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
53
How is the Object class equals() method implemented?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
54
Give an example of how you can create an interface to have a class implement behavior from more than one parent.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
55
What are the advantages to creating a useful, extendable superclass?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
56
What is dynamic method binding and why is it used?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
57
  The AnimalReference application shown above contains a generic Animal reference variable into which you can assign concrete Animal objects. Explain how this example uses polymorphism and why it is important.
The AnimalReference application shown above contains a generic Animal reference variable into which you can assign concrete Animal objects. Explain how this example uses polymorphism and why it is important.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
58
public abstract class Car
{
    private String model;
    public abstract void color();
    public String getName()
    {
        return model;
     }
     public void setName(String carModel)
     {
        model = carModel;
      }
}
Using the code above, would it be possible to create a class in which you declare a Car object with the statement Car myCar = new Car("Honda"); ?
Explain why or why not.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
59
public abstract class Car
{
    private String model;
    public abstract void color();
    public String getModel()
    {
         return model;
     }
    public void setModel(String modelName)
    {
         model = modelName;
     }
}
public class Honda extends Car
{
    public void color()
    {
System.out.println("red");
    }
}
public class Ford extends Car
{
    public void color()
    {
      System.out.println("blue");
    }
}
public class MyCars
{
    public static void main(String[] args)
    {
       Honda myHonda = new Honda();
       Ford myFord = new Ford();
  myHonda.setModel("My Honda is ");
       myFord.setModel("My Ford is ");
  System.out.print(myHonda.getModel());
  myHonda.color();
  System.out.print(myFord.getModel());
  myFord.color();
    }
}
In the above code, the myHonda.getModel() and myHonda.color() method calls produce different output from when the same methods are used with myFord . Explain why this is the case.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
60
When you create a useful, extendable superclass, you and other future programmers gain what advantages?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
61
  An array can be created to reserve space for references to objects. Using the code above, explain how an array of superclass references can hold subclass references.
An array can be created to reserve space for references to objects. Using the code above, explain how an array of superclass references can hold subclass references.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
62
  The shaded header of the talkingAnimal() method accepts any type of Animal argument. Explain how this is possible.
The shaded header of the talkingAnimal() method accepts any type of Animal argument. Explain how this is possible.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
63
public abstract class Car
{
    private String model;
    public abstract void color();
    public String getModel()
    {
         return model;
    }
    public void setModel(String modelName)
    {
         model = modelName;
    }
}
public class Honda extends Car
{
    public void color()
    {
       System.out.println("red");
    }
}
public class Ford extends Car
{
    public void color()
    {
      System.out.println("blue");
    }
}
public class MyCars
{
    public static void main(String[] args)
    {
       Honda myHonda = new Honda();
       Ford myFord = new Ford();
       myHonda.setModel("My Honda is ");
       myFord.setModel("My Ford is ");
       System.out.print(myHonda.getModel());
       myHonda.color();
       System.out.print(myFord.getModel());
       myFord.color();
    }
}
Using the above code, describe the output that will appear when the program is executed.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
64
public abstract class Car
{
    private String model;
    public abstract void color();
    public String getModel()
    {
         return model;
    }
    public void setModel(String modelName)
    {
         model = modelName;
    }
}
The above code creates a generic abstract class named Car with an abstract color() method. Using the code below, fill in the indicated statements in order to create a Honda class that extends Car .
public class --Code here-- extends --Code here--
{
    public void --Code here--
    {
       System.out.println("I like your red car!");
    }
}
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
65
    The code above provides an example of an interface class. Explain the purpose and advantages of creating interfaces that store related constants.
    The code above provides an example of an interface class. Explain the purpose and advantages of creating interfaces that store related constants.
The code above provides an example of an interface class. Explain the purpose and advantages of creating interfaces that store related constants.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
66
public abstract class Shape
{
    private int length;
    private int width;
    private int height;
    ----Code here----
}
Using the above code, create the statement in the place indicated that will create an abstract calculateArea() method in the abstract Shape class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.