aspose file tools*
The moose likes Beginning Java and the fly likes int can not be dereferenced error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "int can not be dereferenced error" Watch "int can not be dereferenced error" New topic
Author

int can not be dereferenced error

Vee Shall
Greenhorn

Joined: Apr 03, 2010
Posts: 7
Hi;
working with fractions which i absolutely hate ( ).........uggh but anywhoo. i'm getting a "int can not be derreferenced" error but i don't see why. All i'm doing is comparing to values to see if they are equal. I'm not using a pointer. What can i do to correct this?

here is my code.






Being a scholar of life does not require a student loan.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61433
    
  67

It might be helpful to point out the line getting the error.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Vee Shall
Greenhorn

Joined: Apr 03, 2010
Posts: 7
heh, guess you're right on that .

this is the line that is getting the errror
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

You're treating a primitive like an object--why not just say r1 == r2???
Vee Shall
Greenhorn

Joined: Apr 03, 2010
Posts: 7
because i thought that compares references and not values??
pete stein
Bartender

Joined: Feb 23, 2007
Posts: 1561
Vee Shall wrote:because i thought that compares references and not values??


True, for reference variables. But are we dealing with reference variables or primitive variables here?
Vee Shall
Greenhorn

Joined: Apr 03, 2010
Posts: 7
umm..........i don't think so??? (of course i'm new to java so i could definately be wrong)
i guess i'm not sure.
Muneeswaran Balasubramanian
Ranch Hand

Joined: Mar 19, 2010
Posts: 138
Hi Vee,
Your code convention is wonderful.You wrote the code as a great developer.
Come to the point,
Stein and david are correct.You are treat the primitives as a values and
with out reference of class RationalNumber how can you call the method of the RationalNumber.
so try to access the methods like reciprocal... by using the object of RationalNumber


Cheers Munees
My Blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: int can not be dereferenced error