Interfaces Flashcards

1
Q

To define (declare) an interface class we use the keyword?

A

Interface

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

interfaces imposed at ? (Compile or runtime)

A

compile time

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

if a class implements an interface, all methods must be ?

A

overridden

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

A class can implement … number of interfaces?

A

many

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

a class can extend how many classes ?

A

at most one

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

interfaces can be in form of ?

A

fields or methods

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

data members of interface are

A

public static final

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

all methods of interface are

A

public abstract

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

interface is implemented using the keyword

A

implements

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

does an interface need a constructor? why?

A

no, because it can’t be instantiated

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

can interfaces inherit each other? how?

A

yes, by using extends

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

java supports multiple inheritance in form of?

A

in form of interfaces

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

all methods in an interface must be overridden, unless?

A

they are declared abstract

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

if a superclass implements an interface, all subclasses?

A

also implement it

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

common interfaces in java?

A
  1. comparable (compareTo())
  2. comparator (compare(), equals())
  3. serializable
  4. cloneable
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

compareTo return values are…

A

-ve, 0 , +ve

17
Q

while compareTo return value means equals

A

0

18
Q

which (abstract or interface) can have abstract and non abstract methods?

A

abstract class

19
Q

which (abstract or interface) can have static, non static, final and non final variables?

A

abstract

20
Q

which (abstract or interface) provides implementation of interface ?

A

abstract

21
Q

which (abstract or interface) only extends interface classes?

A

interfaces

22
Q

abstract classes are inherited using keyword?

A

extends

23
Q

interface are inherited using the keyword?

A

implements

24
Q

interface classes members can have modifiers of

A

public only