interfaces

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/11

encourage image

There's no tags or description

Looks like no tags are added yet.

12 Terms

1
New cards

What is an interface in Java?

An interface is a blueprint that defines methods a class must implement.

2
New cards

What keyword creates an interface?

interface

3
New cards

What keyword connects a class to an interface?

implements

4
New cards

Can a class implement multiple interfaces?

Yes. Java allows a class to implement multiple interfaces.

5
New cards
6
New cards

Can you directly create an object of an interface?

No. Interfaces cannot be instantiated directly.

7
New cards

What kind of methods are abstract by default in an interface?

Methods without a body are abstract by default.

8
New cards

What must a class do when implementing an interface?

Implement all required abstract methods, or be declared abstract itself

9
New cards

Can an interface contain variables?

Yes. Variables are automatically public, static, and final.

10
New cards

What does abstract mean?

A method has no implementation body and must be implemented by a concrete class.

11
New cards

Can interfaces extend other interfaces?

Yes. An interface can extend one or multiple interfaces.

12
New cards

What is the difference between extends and implements?

  • extends inherits a class or interface.

  • implements connects a class to an interface.