About Question enthuware.ocpjp.ii.v11.2.3345 :

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
V_a_l_z
Posts: 1
Joined: Mon Feb 01, 2021 3:30 pm
Contact:

About Question enthuware.ocpjp.ii.v11.2.3345 :

Post by V_a_l_z »

>>>in is a final variable. So, it cannot be reassigned.

It is not entirely true. There is special method System.setIn(InputStream in) for this purpose.

admin
Site Admin
Posts: 10036
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocpjp.ii.v11.2.3345 :

Post by admin »

You are right. The problem statement has been updated to:
"The System.in variable cannot be reassigned to any other stream directly."
and the explanation has also been enhanced to include the setIn method.
thank you for your feedback!
If you like our products and services, please help us by posting your review here.

marcoolivi
Posts: 4
Joined: Wed Jul 27, 2022 7:35 am
Contact:

Re: About Question enthuware.ocpjp.ii.v11.2.3345 :

Post by marcoolivi »

How can a final variable be changed by a method? Does this have to do with the fact that the method setIn0() is labeled "native"?

admin
Site Admin
Posts: 10036
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocpjp.ii.v11.2.3345 :

Post by admin »

That's right. A native method executes low level code directly using OS service calls, bypassing the JVM. This allows it do stuff such as manipulating memory directly.
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 44 guests