"So, elements of a boolean array are initialized to false. int, char, float to 0"
Isn't float 0.0 instead of 0?
About Question enthuware.ocajp.i.v7.2.1077 :
Moderator: admin
-
- Posts: 1
- Joined: Thu May 10, 2018 4:21 am
-
- Site Admin
- Posts: 10036
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.1077 :
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
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.
Who is online
Users browsing this forum: Bing [Bot] and 38 guests