• Post Reply Bookmark Topic Watch Topic
  • New Topic

Noob problem..

 
Jack Nutkins
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I've recently started to program in java...and I have a problem with some code I've written and I can't see where the problem is.

I get the following error:

int cannot be dereferenced

Here is my code:




BlueJ tells me the error is on this line:

Member m = new Member(lastName, firstName, sex, date, score1, score2, score3, score4. score5, score6, score7, score8, score9, score10);

Any help would be much appreciated
 
Henry Wong
author
Sheriff
Posts: 22542
109
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
BlueJ tells me the error is on this line:

Member m = new Member(lastName, firstName, sex, date, score1, score2, score3, score4. score5, score6, score7, score8, score9, score10);

Any help would be much appreciated


Can you give us the exact error message? There is nothing being dereferenced at that line.

Henry
 
Jack Nutkins
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeh bluej is a bit messed up in that respect. If its not on that line then it will be on the line above. As the lines above are all similar then I have a feeling it's somewhere on the lines scores 1 - 10.
The exact error message is as said above:

int cannot be dereferenced

Cheers
 
Rob Spoor
Sheriff
Posts: 20822
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Somewhere you have an int variable, let's call it x for now, which you are trying to dereference: where y is either a field or a method. The compiler will tell you the exact line.
 
Henry Wong
author
Sheriff
Posts: 22542
109
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The exact error message is as said above:

int cannot be dereferenced


That doesn't say anything... Of course, an int can't be dereferenced. You need the full error message from the compiler. And if BlueJ is not showing you the error, and compile it by hand.

Henry
 
D. Ogranos
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


This might be the cause of the problem (in the line where you create the Member).

 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24213
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
D. Ogranos wrote:

This might be the cause of the problem (in the line where you create the Member).



Good eye! Indeed, that period ought to be a comma, and that is definitely the source of the error message.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!