In a pattern matching statement with instanceof, what is the role of a pattern variable?

It defines a new class for the object being matched.

It stores the result of the instanceof check (true or false).

It holds the value of the object if the type matches the pattern.

It allows for custom logic to be applied during the type check.

Verified Answer
Correct Option - c

To get all Infosys Certified Java SE 21 Developer Exam questions Join Telegram Group https://rebrand.ly/lex-telegram-236dee

Telegram