Interface - Day 7 Flashcards

1
Q

Interface

A

Define a generic template that can be implemented by various classes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Containment of interface

A

Method signatures and constant declarations

Declared methods in interface are implicitly public and abstract and the data fields are implicity public, static and final.

Can extend many interfaces and class can implement more than one interface. Multiple inheritance

Class can extend from only one class but can implement infinite interfaces

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Interface key stuff

A

“implements” keyword to implement an interface. The classes implementing an interface must implement all specified methods. IF NOT; abstract classes

Interface creates a type. Can refer to objects of classes which implement that interface. Thus dynamic binding.

Can have default and static (post Java 8… NOT THIS COURSE)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Creating interface

A

public interface PremiumWords {

     Body  }
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Using implement

A

public class PremiumCustomer extends RegularCustomer implements PremiumCards {

     Body  }
How well did you know this?
1
Not at all
2
3
4
5
Perfectly