1/30
Looks like no tags are added yet.
Name  | Mastery  | Learn  | Test  | Matching  | Spaced  | 
|---|
No study sessions yet.
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.
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();).
Concrete Class
A non-abstract class that extends an abstract class and provides implementation for all inherited abstract methods.
Cannot Instantiate Abstract Class
An abstract class cannot be instantiated directly (e.g., Pet p = new Pet(); does not compile).
Non-Abstract Members in Abstract Class
An abstract class may include non-abstract methods and variables.
Abstract Class Cannot Be Final
An abstract class cannot be marked final because a final class cannot be extended.
Inheritance of Abstract Methods
An abstract class that extends another abstract class inherits all abstract methods as its own.
First Concrete Class Rule
The first concrete class that extends an abstract class must implement all inherited abstract methods.
Abstract Method Rule
Abstract methods can only be defined in abstract classes.
Final Modifier Restriction
An abstract method cannot be marked final because final methods cannot be overridden.
Private Modifier Restriction
An abstract method cannot be marked private since it must be accessible to subclasses.
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.
Interface
A collection of related abstract public methods; may also contain default methods, static methods, and constant declarations.
Interface Keyword
Created using the interface keyword (e.g., public interface Drinkable { }).
Interface Members
Methods in interfaces are implicitly public abstract; constants are implicitly public static final.
Implementing an Interface
A class uses implements to adopt an interface (e.g., public class Water implements Drinkable { }).
Multiple Interfaces
A class can implement multiple interfaces (e.g., public class Water implements Drinkable, Potable { }).
Cannot Instantiate Interface
Interfaces cannot be instantiated directly (new Drinkable(); does not compile).
Interface Without Methods
Interfaces are not required to have methods.
Interface Cannot Be Final
An interface cannot be marked as final.
Interfaces Are Implicitly Abstract
Using abstract in interface declarations is optional; all interfaces are abstract by default.
Interface Method Visibility
All abstract, default, and static methods in interfaces are implicitly public.
Interface Inheritance Rule
An interface that extends another interface inherits all abstract methods of its parent interfaces.
Abstract Class Implementing Interface
An abstract class implementing an interface inherits abstract methods but is not required to implement them.
First Concrete Class Rule (Interface)
The first non-abstract class that implements an interface must provide implementation for all inherited abstract methods.
Class Cannot Extend Interface
A class cannot use extends on an interface (public class Water extends Drinkable does not compile).
Interface Cannot Extend Class
An interface cannot extend a class (public interface Drinkable extends Water does not compile).
Interface Cannot Implement Interface
Interfaces cannot use implements with other interfaces (public interface Potable implements Drinkable does not compile).
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.
Overloaded Methods in Interfaces
A class can implement interfaces containing overloaded methods (same name but different parameters).
Conflicting Return Types
A class cannot implement interfaces containing methods with the same name and parameters but different return types.