WEEK 8 2005

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

1/22

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 7:03 AM on 4/25/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

23 Terms

1
New cards

What is multiple inheritance?

A feature where a class can inherit from more than one superclass.

2
New cards

Why does Java not allow multiple inheritance?

To avoid ambiguity in method and field resolution when two superclasses have the same method or field.

3
New cards

What is an abstract method?

A method that is declared without an implementation and must be overridden in a subclass.

4
New cards

What keyword is used to implement interfaces in Java?

Implements

5
New cards

Can a class in Java implement multiple interfaces?

Yes, a class can implement any number of interfaces.

6
New cards

What is the default access modifier for interfaces in Java?

Public

7
New cards

What is the purpose of an interface in Java?

To define a contract that classes can fulfill, consisting of abstract methods.

8
New cards

How are interfaces defined in Java?

Using the keyword 'interface' followed by the interface name.

9
New cards

What is a default method in an interface?

A method that has an implementation within the interface itself.

10
New cards

What is the Collection interface in Java?

An interface representing any group of objects, with subinterfaces for lists, queues, etc.

11
New cards

What is an ArrayList in Java?

A resizable array implementation of the List interface, providing flexible array operations.

12
New cards

What is the Map interface in Java?

An interface that represents a collection of key-value pairs, similar to a Python dictionary.

13
New cards

What is polymorphism in the context of interfaces?

The ability to use an interface type as a variable type, allowing for different implementations.

14
New cards

What happens if two interfaces have the same variable name?

It causes a compilation error due to duplicated variable names.

15
New cards

What is the significance of the Stack interface?

It defines a contract for stack operations, allowing for various implementations without exposing details.

16
New cards

What is the difference between a class and an interface?

A class represents a type of thing, while an interface represents a notion or trait.

17
New cards

Can interfaces extend other interfaces?

Yes, interfaces can extend other interfaces and can extend more than one interface.

18
New cards

What is the role of static final fields in interfaces?

They can be defined in interfaces, but any duplication across interfaces leads to compilation errors.

19
New cards

What is an example of an interface that represents a trait?

HasLegs, which can be implemented by any class that has legs.

20
New cards

What is a key characteristic of Java Collections?

They can only contain objects, not primitive types.

21
New cards

What does the <> symbol signify in Java's ArrayList?

It specifies the type of elements contained in the list.

22
New cards

What is the relationship between interfaces and method implementation?

Interfaces define methods that must be implemented in the classes that use them.

23
New cards

How does Java ensure backward compatibility with collections?

Existing classes like Stack cannot be removed even after introducing interfaces.