About Question enthuware.ocajp.i.v7.2.1027 :

All the posts and topics that contain only an error report will be moved here after the error is corrected. This is to ensure that when users view a question in ETS Viewer, the "Discuss" button will not indicate the presence of a discussion that adds no value to the question.

Moderators: Site Manager, fjwalraven

Post Reply
radupana
Posts: 28
Joined: Fri Feb 09, 2018 11:50 am
Contact:

About Question enthuware.ocajp.i.v7.2.1027 :

Post by radupana »

I don't believe the code will compile (at least the version I have, where Integer.valueof(5,16) is called).

There is no valueOf method that takes two ints, defined on Integer, in Java 21.
The closest is public static Integer valueOf(String s, int radix): https://docs.oracle.com/en/java/javase/ ... tring,int)

Even the explanation uses the (String, int) signature:
3. Note that the exam expects you to know the basics of hexadecimal numbers. Specifically, you should know that the hexadecimal system has 16 digits - 0 to 9 and a, b, c, d, e , f. Thus, Integer.valueof("a", 16), will return 10. The digit 5 in hexadecimal is the same as 5 in decimal though.

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

Re: About Question enthuware.ocajp.i.v7.2.1027 :

Post by admin »

Yes, it should be valueOf("5", 16). This was mistakenly updated from 5 to to 5, 16 in the most recent version. Integer.valueOf(5) is fine but Integer.valueOf(5, 16) is not.
Fixed.
thank you for your feedback!

Post Reply

Who is online

Users browsing this forum: No registered users and 10 guests