DSA PreFi

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/30

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

31 Terms

1
New cards

Abstract Class

A class created to ensure that subclasses implement necessary methods. Cannot be instantiated directly and may contain both abstract and non-abstract methods.

2
New cards

Abstract Method

A method with no body that must be implemented by subclasses. Declared without braces but with a semicolon (e.g., abstract void draw();).

3
New cards

Concrete Class

A non-abstract class that extends an abstract class and provides implementation for all inherited abstract methods.

4
New cards

Cannot Instantiate Abstract Class

An abstract class cannot be instantiated directly (e.g., Pet p = new Pet(); does not compile).

5
New cards

Non-Abstract Members in Abstract Class

An abstract class may include non-abstract methods and variables.

6
New cards

Abstract Class Cannot Be Final

An abstract class cannot be marked final because a final class cannot be extended.

7
New cards

Inheritance of Abstract Methods

An abstract class that extends another abstract class inherits all abstract methods as its own.

8
New cards

First Concrete Class Rule

The first concrete class that extends an abstract class must implement all inherited abstract methods.

9
New cards

Abstract Method Rule

Abstract methods can only be defined in abstract classes.

10
New cards

Final Modifier Restriction

An abstract method cannot be marked final because final methods cannot be overridden.

11
New cards

Private Modifier Restriction

An abstract method cannot be marked private since it must be accessible to subclasses.

12
New cards

Overriding Abstract Methods

To override an abstract method, the subclass must declare a method with the same name, parameter list, and return type, and it must be at least as accessible as the parent method.

13
New cards

Interface

A collection of related abstract public methods; may also contain default methods, static methods, and constant declarations.

14
New cards

Interface Keyword

Created using the interface keyword (e.g., public interface Drinkable { }).

15
New cards

Interface Members

Methods in interfaces are implicitly public abstract; constants are implicitly public static final.

16
New cards

Implementing an Interface

A class uses implements to adopt an interface (e.g., public class Water implements Drinkable { }).

17
New cards

Multiple Interfaces

A class can implement multiple interfaces (e.g., public class Water implements Drinkable, Potable { }).

18
New cards

Cannot Instantiate Interface

Interfaces cannot be instantiated directly (new Drinkable(); does not compile).

19
New cards

Interface Without Methods

Interfaces are not required to have methods.

20
New cards

Interface Cannot Be Final

An interface cannot be marked as final.

21
New cards

Interfaces Are Implicitly Abstract

Using abstract in interface declarations is optional; all interfaces are abstract by default.

22
New cards

Interface Method Visibility

All abstract, default, and static methods in interfaces are implicitly public.

23
New cards

Interface Inheritance Rule

An interface that extends another interface inherits all abstract methods of its parent interfaces.

24
New cards

Abstract Class Implementing Interface

An abstract class implementing an interface inherits abstract methods but is not required to implement them.

25
New cards

First Concrete Class Rule (Interface)

The first non-abstract class that implements an interface must provide implementation for all inherited abstract methods.

26
New cards

Class Cannot Extend Interface

A class cannot use extends on an interface (public class Water extends Drinkable does not compile).

27
New cards

Interface Cannot Extend Class

An interface cannot extend a class (public interface Drinkable extends Water does not compile).

28
New cards

Interface Cannot Implement Interface

Interfaces cannot use implements with other interfaces (public interface Potable implements Drinkable does not compile).

29
New cards

Overlapping Methods in Interfaces

A class can implement multiple interfaces containing methods with the same name, as long as the signatures and return types match.

30
New cards

Overloaded Methods in Interfaces

A class can implement interfaces containing overloaded methods (same name but different parameters).

31
New cards

Conflicting Return Types

A class cannot implement interfaces containing methods with the same name and parameters but different return types.