1z0-819 Exam QuestionsBrowse all questions from this exam

1z0-819 Exam - Question 102


Given the code fragment:

Which two code snippets inserted independently inside println method print Mondial:domainmodel? (Choose two.)

Show Answer
Correct Answer: BCD

To print 'Mondial:domainmodel', the code must concatenate the 'prefix' static field and the 'name' instance field. Option C works because it correctly uses the static 'prefix' field and calls the static 'getName()' method which returns the 'name' field from a new Main instance. Option D works because it creates a new instance of Main to access both 'prefix' and 'name' fields directly, ensuring it uses their values properly.

Discussion

3 comments
Sign in to comment
StavokOptions: CD
Jul 19, 2023

C & D are correct TESTED

ObaltOptions: CD
Feb 4, 2023

Correct answer is C & D

ASPushkinOption: C
Jun 14, 2024

C - access to private modifier inside the class is Ok (doesn't matter which instance)