The answer is A, I tested. But why don't we get compilation error as super and this are supposed to be first statement in a constructor ? Can someone explain?
super.display() invoke S1 display method. need to be aware its not be using "super()". The same thing is happening with this.display() its invoke a method too, not be using "this()"
display() is been overloading & overriding. JVM will automatically create a default constructor to initialize all fields (which in these cases there are no any attribute fields)
JVM will automatically create a default constructor to initialize all fields (which in these cases there are no any attribute fields) so there will be no any compile time error.
upvoted 2 times
...
...
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
MPignaProTech
2 months, 1 week agoSisar
4 months, 1 week agoamit_lad88
1 year agoJess1985B
1 year, 1 month agoDriftKing
1 year, 4 months agoManuTov
1 year, 2 months agoManuTov
1 year, 2 months agokuuu
1 year, 11 months agocarloswork
2 years, 2 months agoUAK94
2 years, 2 months agoalex_au
2 years, 2 months agoiSnover
2 years, 2 months agoalex_au
2 years, 2 months ago