Skip to document

AP Computer Science A Notes

AP Computer Science A Notes pt 2
Subject

AP Computer Science A

814 Documents
Students shared 814 documents in this course
Level

AP

Academic year: 2020/2021
Uploaded by:
0followers
15Uploads
4upvotes

Comments

Please sign in or register to post comments.

Preview text

AP Computer Science A Notes: Inheritance defines a relationship between _______ that share characteristics objects Inheritance is when a new class () is created from an existing class () subclass, superclass The subclass _______ characteristics of its superclassinherits

When methods of superclasses are overwritten by subclasses Method overriding If part of the original method implementation from the superclass is retained, the rewrite is referred to as _______Partial overriding

Interfaces are implemented using what keyword? Implements True or false: A class that extends a superclass can alstrue o implement an interface.

When a class extends a superclass AND implements an interface, which clause comes first? the extends clause True or false: A class can have just one superclass. True True or false: A class can only have one interface

An (interface/abstract class) typically does NOT provide implementations for any of its methods, while an (interface/abstract class) can; abstract class

What methods of Object are important to know? (2)toString; equals

What does the default toString() return? the class name, an @, and the memory address of the object Why should you redefine the toString method for all of your classes?

to help in debugging Do Array objects have a toString method? No Why is a ClassCastException thrown? to signal an attempt to cast an object to a class of which it is not an instance Define abstract class superclass that represents an abstract concept, and is not instantiated

An abstract class may contain... abstract methods An abstract method only has a... header How do you print the elements of an array?traverse the array and explicitly print each element

When will the equals() method return true? If the objects being compared reference the same memory slot If you want the equals() method to test the contentsyou must... of an object rather than its memory location, override the method The default implementation of equals() is equivalent to what operator? == What do you use to test objects for equality?equals()

What is a String object defined as? a sequence of characters

Was this document helpful?

AP Computer Science A Notes

Subject: AP Computer Science A

814 Documents
Students shared 814 documents in this course
Level:

AP

Was this document helpful?
AP Computer Science A Notes:
Inheritance defines a relationship between _______ that share characteristics
objects
Inheritance is when a new class (_______) is created from an existing class (_______)
subclass, superclass
The subclass _______ characteristics of its superclass
inherits
When methods of superclasses are overwritten by subclasses
Method overriding
If part of the original method implementation from the superclass is retained, the rewrite is
referred to as _______
Partial overriding
Interfaces are implemented using what keyword?
Implements
True or false: A class that extends a superclass can also implement an interface.
true
When a class extends a superclass AND implements an interface, which clause comes first?
the extends clause
True or false: A class can have just one superclass.
True
True or false: A class can only have one interface.
False
An (interface/abstract class) typically does NOT provide implementations for any of its methods,
while an (interface/abstract class) can.
interface; abstract class
What methods of Object are important to know? (2)
toString; equals
What does the default toString() return?
the class name, an @, and the memory address of the object
Why should you redefine the toString method for all of your classes?