Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within OCPJP
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Tim Cooke
paul wheaton
Jeanne Boyarsky
Ron McLeod
Sheriffs:
Paul Clapham
Liutauras Vilda
Devaka Cooray
Saloon Keepers:
Tim Holloway
Roland Mueller
Bartenders:
Forum:
Programmer Certification (OCPJP)
Wrapper
Shiva Mohan
Ranch Hand
Posts: 486
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
public class Chapter8 { public static void main(String args[]) { Float f1 = new Float(1.0f); //1 Float f2 = new Float(1.0); //2 Float f3 = new Float("1.0"); //3 System.out.println(f1.equals(f2));//line 1 System.out.println(f2.equals(f3)); } }
does this f1 float value is promoted to double value for equlas() method evaluation
Keith Lynn
Ranch Hand
Posts: 2412
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
No, it doesn't convert the Floats to a double.
This is from the source code for Float.
public boolean equals(Object obj) { return (obj instanceof Float) && (floatToIntBits(((Float)obj).value) == floatToIntBits(value)); }
permaculture is a more symbiotic relationship with nature so I can be even lazier. Read tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Comparison of arrays
Invoking equals method on float object
( int a = 2147483648 ) vs (int a = 2147483647 ; a=a+1 )
Usage of :- int comapareTo(float f)
operator
More...