AP CS chapters 23-24

0.0(0)
Studied by 1 person
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/20

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 5:41 PM on 3/28/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

21 Terms

1
New cards

polymorphism

subclasses have unique behavior for common superclass methods

2
New cards

overriding superclass methods

declaration matches superclass’ method exactly - often called virtual methods

3
New cards

what type of an object does java understand at runtime?

Java understands the actual type of the object at runtime. When you call a method through a superclass reference, if the actual object has an overridden version of that method, Java will call that overridden version instead.

4
New cards

methods that are virtual by default

all public, or protected methods on a superclass - they can be overridden by subclasses

5
New cards

two cases where superclass method cannot be overidden

  1. the superclass method is private (subclasses can’t access them)

  2. the superclass method is marked with the final keyword

6
New cards

@Override flag

optional - use if you intend to override superclass method and want the compiler to check that this is possible - produces a compile-time error if the method failed to be overriden

7
New cards

abstract method

a method with a signature but no method body - each subclass implements it with its own definition - guarantees that this method is the one implemented by all subclasses

8
New cards

when to mark a class as abstract?

when the class has at least one abstract method. it is also convention to include abstract in the class name when this is the case

9
New cards

concrete class

subclass that implements all required abstract methods

10
New cards

can overrided superclass methods be called by external code

no - only the subclass versions can

11
New cards

how to use overided method in a subclass?

use super.*method()*

12
New cards

can super. for methods be used anywhere in the subclass?

yes - not like constructors

13
New cards

to access superclass property:

add super keywoord in front of property name

14
New cards

object identity

a unique instance of an object - == operator returns true if two references point to the same object (same space in memory)

15
New cards

object equality

java.lang.Object.equals() operator - compares objects to see if they point to the same reference (identity test) - ex. two hammers

16
New cards

why override java.lang.Object.equals()?

to compare objects by properties, not just check identity

method signature:

public boolean equals(Object obj)

17
New cards

how to refer to the object that owns a method?

this. - optional

18
New cards

output of Object.toString() Method?

human-readable string output representing the object ex:

java.lang.Object@7d8a992f

19
New cards

why override toString()?

to provide more useful and clear description of the object - can select properties to display

20
New cards

Given the SchoolBus class definition below...

   class SchoolBus
   {
      private String color = "yellow";
      public boolean equals(Object obj)
      {
         return ((SchoolBus)obj).color.equals(color);
      }
   }

...what will be displayed by the following code?

   SchoolBus bus1 = new SchoolBus();
   SchoolBus bus2 = new SchoolBus();
   System.out.println( bus1.equals(bus2) );


true

21
New cards

Explore top notes

note
AP Gov: Chapter 1 Vocab
Updated 1299d ago
0.0(0)
note
Unit 7: Evolution (Biology)
Updated 710d ago
0.0(0)
note
Mitosis
Updated 751d ago
0.0(0)
note
diplomacy
Updated 1251d ago
0.0(0)
note
Le Chatelier's Principle
Updated 1158d ago
0.0(0)
note
AP Gov: Chapter 1 Vocab
Updated 1299d ago
0.0(0)
note
Unit 7: Evolution (Biology)
Updated 710d ago
0.0(0)
note
Mitosis
Updated 751d ago
0.0(0)
note
diplomacy
Updated 1251d ago
0.0(0)
note
Le Chatelier's Principle
Updated 1158d ago
0.0(0)

Explore top flashcards

flashcards
Kite Runners Vocab
35
Updated 68d ago
0.0(0)
flashcards
Midterm
238
Updated 389d ago
0.0(0)
flashcards
Describing People SPN2 PreAP
91
Updated 221d ago
0.0(0)
flashcards
Cellular Respiration Review
22
Updated 1215d ago
0.0(0)
flashcards
apush 3.1-3.4
52
Updated 578d ago
0.0(0)
flashcards
Chapter 9 Med Term
25
Updated 1217d ago
0.0(0)
flashcards
Posterior Muscles
47
Updated 1244d ago
0.0(0)
flashcards
SALUD Y BIENESTAR vocabulario
33
Updated 913d ago
0.0(0)
flashcards
Kite Runners Vocab
35
Updated 68d ago
0.0(0)
flashcards
Midterm
238
Updated 389d ago
0.0(0)
flashcards
Describing People SPN2 PreAP
91
Updated 221d ago
0.0(0)
flashcards
Cellular Respiration Review
22
Updated 1215d ago
0.0(0)
flashcards
apush 3.1-3.4
52
Updated 578d ago
0.0(0)
flashcards
Chapter 9 Med Term
25
Updated 1217d ago
0.0(0)
flashcards
Posterior Muscles
47
Updated 1244d ago
0.0(0)
flashcards
SALUD Y BIENESTAR vocabulario
33
Updated 913d ago
0.0(0)