Page 1 of 1

About Question enthuware.ocpjp.v11.2.3140 :

Posted: Tue Feb 23, 2021 2:17 pm
by mikolajczak4
Hi,

I have one doubt in that answer.

Code: Select all

Double dVal = 0.0;
if((dVal = Double.parseDouble(str)) == iVal){ //2
== has precedence over = so the result of Double.parseDouble(str)) == iVal is boolean and it is assigned to dVal which is Double.

Do I miss something here ?

Thanks,
Wojciech

Re: About Question enthuware.ocpjp.v11.2.3140 :

Posted: Tue Feb 23, 2021 6:05 pm
by admin
But there are parentheses involved. The expression dVal = Double.parseDouble(str) is surrounded by ( ). So, it has to be evaluated first. Operator precedence would have come into picture to resolve the ambiguity if all the terms of an expression were at the same level i.e.

dVal = Double.parseDouble(str) == iVal

Re: About Question enthuware.ocpjp.v11.2.3140 :

Posted: Sat Feb 27, 2021 12:09 pm
by mikolajczak4
my bad, thank you !

Re: About Question enthuware.ocpjp.v11.2.3140 :

Posted: Mon Sep 19, 2022 7:00 pm
by cjgiron
Hello Admin,

Will the actual test expect us to know how to parse numbers with the radix parameter?

Re: About Question enthuware.ocpjp.v11.2.3140 :

Posted: Tue Sep 20, 2022 9:43 pm
by admin
You will not need to convert or parse values but you may see a question that requires you to know that such a method exists.