This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes can't be dereferenced... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply locked New topic
Author

can't be dereferenced...

Robbie Harjes
Greenhorn

Joined: Nov 09, 2003
Posts: 22

This is obviously inside a for loop, i++ until there's no more characters left to process. For some reason I'm getting the "char cannot be dereferenced" error. I don't know how to fix this seeing how I'm using a .replace() function.. Not like I can just go something like "TEMP = Character.toUpperCase(TEMP);"
Help?
William Barnes
Ranch Hand

Joined: Mar 16, 2001
Posts: 984

The class "char" has a "replace" method?
So if you are in a loop the first interation would set TEMP to "h". And you want to than replace "h" with the result of a call to "replace" on the same variable. If there is a "replace" method, than why would you need to do the assignment?


Please ignore post, I have no idea what I am talking about.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30136
    
150

Robbie,
TEMP is called a primitive variable. Primative types include char, int and boolean. These types cannot be used to call methods. This is why you are getting the de-reference error.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Robbie Harjes
Greenhorn

Joined: Nov 09, 2003
Posts: 22
Thanks for all the help. I'm too stupid to realize the obvious. Thanks again.
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9044
    
  10
Please add further responses to this duplicate thread.


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: can't be dereferenced...
 
Similar Threads
u_int8_t in java
clearing white space
what does char name[] = new char[ 15 ], temp; do
Convert to upper case
"char cannot be dereferenced error"