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
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Programmer Certification (OCPJP)
Error: float cannot be dereferenced
Rahul mir
Ranch Hand
Posts: 38
I like...
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi,
please someone explane the error :
Error: float cannot be dereferenced, in the following code.
class Autobox2 { public static void main(String[] args){ Float A=9.0F; float a =(float)9.0; System.out.println(A.equals(a)); System.out.println(a.equals(A)); System.out.println(a<=A); System.out.println(A<=a); } }
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
I like...
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
look at line 6 . you cant call method on primitives.
Rahul mir
Ranch Hand
Posts: 38
I like...
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
ya, we can't call method on primitive .. but in error message, float cannot be dereferenced..
dereferenced
thing i am not getting.
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
I like...
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
dereference - finding an appropriate object via reference. here you cant find object since float is a primitive, hence error.
Rahul mir
Ranch Hand
Posts: 38
I like...
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Ok, got it.. here equals method try to find the value of primitive type variable, from it's reference, that's why dereferenced error came..
thanks.
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
I like...
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
you are welcome
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
One doubt
float error
Autoboxing- dereference a primitive
float doubt
char cannot be dereferenced
More...