Assuming the following declarations are top-level types declared in the same file, which successfully compile?

Record Cricket() {
final int score = 10;
}
record Book(String words) {
Book{
this.words = words + "Hello World";
}
}
sealed class Dance {}
record Hobby() {
@Override
String toString() { return null; }
}
class Divi extends Dance {}

Cricket

Book

Dance

Hobby

Correct Option - c

To get all Infosys Certified Java SE 17 Developer Exam questions Join Group https://bit.ly/infy_premium_group

We're passionate about offering best placement materials and courses!! A one stop place for Placement Materials. We daily post Offcampus updates and Placement Materials.

Qtr No. 213, New Town Yehlanka Indore 454775

admin@prepflix.in