"double cannot be dereferenced"
1 posts in topic
Flat View  Flat View

Posted By:   Andrew_Clarke
Posted On:   Tuesday, January 22, 2002 05:28 AM

I am attempting to use doubles as arguments to a method called from another class. However the compiler fails with the message "Java 33: double cannot be dereferenced"

What does this mean? How can I correct my code to do what I want?

Is there anywhere that defines these error messages, probable causes and possible solutions? I couldn't find anything in the documentation that comes with the JDK. Normally I can figure them out, but this one's got me stumped.

Thanks, APC

Re: "double cannot be dereferenced"

Posted By:   Christopher_Schultz  
Posted On:   Tuesday, January 22, 2002 10:35 AM

You'll get this weird error (I say weird because usually Java-type-people don't think about dereferencing stuff) if you put a dot after a primitive:

double d = 3.141592654288;


This will give you a compiler error. If you want to use a Double object, then use the java.lang.Double class, which has methods and everything. My guess is that you are calling a method on a primitive that you thought was an object.

Check your code, and it'll probably jump right out at you.

Hope that helps,

About | Sitemap | Contact