This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Compile error message

 
Becky Wilson
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need help with a compiler message:
int cannot be dereferenced. Can anyone help with this?
Here is the code it is references:

decrypted = (index.charAt(0) - 7) + (index.charAt(1) - 7) + (index.charAt(2) - 7) + " " + (index.charAt(4) + 3) + (index.charAt(5)+ 3) + " " + (index.charAt(6) + 3) + (index.charAt(7) + 3) + (index.charAt(8) + 3) + (index.charAt(9) + 3);
//this is the calculation to decrypt the input and names it decrypted


Here is the actual compiler message:
int cannot be dereferenced

decrypted = (index.charAt(0) - 7) + (index.charAt(1) - 7) + (index.charAt(2) - 7) + " " + (index.charAt(4) + 3) + (index.charAt(5)+ 3)

the pointer is aimed at the . between the word index and charAt
 
Jeff Bosch
Ranch Hand
Posts: 805
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Becky -

It's possible the error occurred on the line before the snippet, or that decrypted is an int (though that should give a different error). Can you provide the declaration for decrypted and index? Maybe I can help if I see more.

Thanks.
 
Amit Saini
Ranch Hand
Posts: 280
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
You generally get this error if you are using the .operator on a primitive.
eg int i; i.(any function) will give you this error. Which is why you need to use wraper classes to perform those operations.

Whats the datatype of index?

-Amit
 
Jeff Bosch
Ranch Hand
Posts: 805
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I created the following test program from your code, and it worked fine:



Could you have a typo in your source?
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic