Interfaces Flashcards

1
Q

If interfaces cannot be instantiated, what are they?

A

Implemented by other classes

Extended by other interfaces

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

Interface method definition

A

Access modifier, interface keyword, interface name, parent interfaces, interface body

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

Interface Access Modifiers should be…

A

Should be public else interface is only accessible to classes defined in same package as interface

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

Abstract Method

A

Interface followed by semicolon
No braces
Does not contain implementation

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

Default Method–How to Define

A

Default keyword at beginning of method signature

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

Default Method–Defn

A

Allow for evolving interfaces by adding new functionality to existing interfaces and allowing for binary compatibility with older code

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

Static Methods–How to Define

A

Static keyword

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

Constant Declarations

A

Way to say an interface value is public, static and final

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

Implicitly public methods

A

Abstract, default and static methods

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

When defining a reference variable with an interface as its type…

A

..any object assigned to it MUST be ab instance of a class that implements the interface

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

Options for extending an interface containing a default method

A

Don’t reference default method
Redeclare default method (makes it abstract)
Redefine the default method

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

Things contained in an interface

A
Constants
Method signatures
Default methods
Static methods
Nested Types
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Interface method bodies exist only for…

A

Default methods and static methods

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