What is the result?

Given the code fragment: What is the result?

Given the code fragment: What is the result?

A.
Jesse 25 Walter 52

B.
Compilation fails only at line n1

C.
Compilation fails only at line n2

D.
Compilation fails at both line n1 and line n2



Leave a Reply 9

Your email address will not be published. Required fields are marked *


TC

TC

OPtion D is the answer

Kaykay

Kaykay

Definitely D.

BENDIABDELLAH Adil

BENDIABDELLAH Adil

B

Jadson

Jadson

D
there is no this() can’t be call in n1
Person(name) should be changed to this(name) in n2

giosefer

giosefer

Correct answer is D.

The code compile if you replace in the first constructor “this()” with “this (name,age)” and in the second constructor “Person(name,age)” with “this(name,age)”

Regards.