This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Error: float cannot be dereferenced Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Error: float cannot be dereferenced" Watch "Error: float cannot be dereferenced" New topic
Author

Error: float cannot be dereferenced

Rahul mir
Ranch Hand

Joined: Oct 31, 2012
Posts: 38

Hi,
please someone explane the error :
Error: float cannot be dereferenced, in the following code.

Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

look at line 6 . you cant call method on primitives.
Rahul mir
Ranch Hand

Joined: Oct 31, 2012
Posts: 38

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

Joined: Jan 28, 2008
Posts: 5575

dereference - finding an appropriate object via reference. here you cant find object since float is a primitive, hence error.
Rahul mir
Ranch Hand

Joined: Oct 31, 2012
Posts: 38

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

Joined: Jan 28, 2008
Posts: 5575

you are welcome
 
wood burning stoves
 
subject: Error: float cannot be dereferenced
 
Similar Threads
Autoboxing- dereference a primitive
float error
One doubt
float doubt
char cannot be dereferenced