Page 1 of 1
About Question enthuware.ocpjp.v8.2.1163 :
Posted: Mon Nov 19, 2018 4:02 pm
by MoistCarrot
The questions states...
(Assume appropriate import statements)
The following explanation is offered for option 2...
In this question, the import statements are not specified. If appropriate imports are present (i.e. import static java.util.Locale.*; ), this will work fine.
Since appropriate import statements are assumed, wouldn't that also make option 2 correct? I believe this may be confusing or misleading.
Re: About Question enthuware.ocpjp.v8.2.1163 :
Posted: Mon Nov 19, 2018 9:21 pm
by admin
Yes, that is why the explanation also says the following after the statement that you've quoted:
In the exam, you may see a couple of question that have such ambiguous options. In our opinion, it is best not to assume anything special or out of ordinary. Therefore, this option should not be selected.
The exam does mention that appropriate imports are to be assumed. But assuming static imports? We don't know. Use your discretion.
Re: About Question enthuware.ocpjp.v8.2.1163 :
Posted: Sun Jan 17, 2021 7:20 am
by Deleted User 6318
Note that once a ResourceBundle is retrieved, changing the Locale will not affect the ResourceBundle.
But can it even be changed later? If yes, in what way?
Re: About Question enthuware.ocpjp.v8.2.1163 :
Posted: Mon Jan 18, 2021 7:37 am
by admin
Yes, you can set the myLoc variable to a different Locale object. Of course, you can't change a Locale object itself because it is immutable.
Re: About Question enthuware.ocpjp.v8.2.1163 :
Posted: Mon Jan 18, 2021 3:04 pm
by Deleted User 6318
Oh gosh, this is so obvious. I'm sorry, but I wouldn't call it "changing the Locale" - like you wrote it's immutable, so as per my understanding you cannot really change it. You can replace the reference, but then you're not changing any locale object..
Re: About Question enthuware.ocpjp.v8.2.1163 :
Posted: Sat Jan 23, 2021 10:36 am
by admin
Hmm...never heard the phrase "replacing a reference" used in a technical discussions. But anyway I think in the context of this question, it is quite clear what the explanation is trying to convey.