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

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

Moderator: admin

Post Reply
SoFine
Posts: 1
Joined: Thu May 10, 2018 4:21 am

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

Post by SoFine »

"So, elements of a boolean array are initialized to false. int, char, float to 0"

Isn't float 0.0 instead of 0?

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

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

Post by admin »

There is no difference between 0 and 0.0 in case of float and double. The following code prints true.
float x = 0;
float y = 0.0;
System.out.println(x == y);

But they are different for Float and Double.

Float x = 0f;
Float y = 0.0f;
System.out.println(x == y); //prints false
System.out.println(x.equals(y)); //prints true
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 38 guests