Flashcards

Quick study sessions to strengthen memory and retain key concepts.

Flashcard Study

Java: this Keyword

Front

Why can't 'this' be used in static methods?

Static methods do not belong to any object instance. 'this' refers to an instance of a class, but…

View Card →
Flashcard Study

Java: this Keyword

Front

What does 'this' refer to in a method?

It refers to the current object instance. Frame the concept in practical terms so you can explain it…

View Card →
Flashcard Study

Java: this Keyword

Front

How does 'this' help in distinguishing class fields from method parameters?

It allows clear differentiation between fields and parameters with the same name. In constructors, parameters often have the…

View Card →
Flashcard Study

Java: this Keyword

Front

What does `this` mean in a constructor?

It refers to the current object being initialized. A common beginner use is `this.field = parameter;`, which clearly…

View Card →
Flashcard Study

Java: Polymorphism

Front

How can substitutability through polymorphism introduce complexity?

Substitutability can lead to unforeseen interactions between objects. Substitutability allows objects of a superclass type to be replaced…

View Card →
Flashcard Study

Java: Polymorphism

Front

Why does polymorphism reduce caller coupling?

It abstracts the implementation details for the caller. Polymorphism reduces caller coupling by allowing the caller to interact…

View Card →
Flashcard Study

Java: Polymorphism

Front

How does polymorphism support one interface with many implementations?

Polymorphism allows different classes to implement the same interface. Polymorphism enables a single interface to be implemented by…

View Card →
Flashcard Study

Java: Polymorphism

Front

What are the trade-offs of using polymorphism in large-scale applications?

Polymorphism increases flexibility but can complicate code understanding and debugging. While polymorphism enhances code flexibility and reusability, it…

View Card →
Flashcard Study

Java: Polymorphism

Front

How do abstract classes support polymorphism?

Abstract classes allow shared code and enforced method implementation in subclasses. Abstract classes can implement some methods and…

View Card →
Flashcard Study

Java: Polymorphism

Front

Why might polymorphism introduce unexpected behavior in Java?

Incorrectly assuming the object's actual type may lead to unexpected method execution. Polymorphism can cause unexpected behavior if…

View Card →