Forums Register Login

Compile error message

+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
I created the following test program from your code, and it worked fine:



Could you have a typo in your source?
rubbery bacon. crispy tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 555 times.
Similar Threads
Arrays...
summing each row in a 2-dimensional array
Multidimensional Arrays
BufferedImage ?
Can anyone explain please
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 18:58:30.