Flashcards
Quiz 3 1302
Cards in this deck (8)
- 1What are Abstract Classes/Methods?A class or method that is declared with abstract keyword
- 2How to write abstract class?"public 'abstract' class className"
- 3What are characteristics of abstract class?Cannot be instantiated
can have constructors
can have non-abstract methods
no restrictions on attributes
&
keywords: "abstract class extends" - 4How to write abstract method?"public 'abstract' datatype methodName();"
- 5What is Polymorphism?The ability of an object to take on many forms, used in implementing inheritance.
- 6What are Interfaces?It is like a abstract class but only has abstract methods.
- 7What are characteristics of Interfaces?cannot be instantiated
cannot have constructors
can only have abstract methods
&
attributes MUST be "public static final" keyword interface - 8How woud you write a interface named "pluggable" with a method "plugIn" that returns a boolean for whether a device is receiving power from the outlets and has a parameter for the voltage needed as an "int"public interface Pluggable {
public abstract boolean plugIn(int voltage);
}
Information
- Description
- we gotta pass!
- Created by
- marc30599 .
- Views
- 1
- Rating
More on Abstract Classes and Interfaces