Home arrow static arrow Java Programming [Archive] - valueof
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - valueof
This topic has 3 replies on 1 page.

Posts:25
Registered: 7/10/03
valueof  
Jun 28, 2004 7:57 AM



 
I'm wondering why this never works

mystring = String.valueof(mychar[5]);

Where mychar is a character array, and 5 is some arbitrary index. mystring is a String. I get an error...

cannot resolve symbolsymbol  : method valueof (char)location: class java.lang.String				mystring = String.valueof(mychar[5]);                                                 ^
 

Posts:31,095
Registered: 4/30/99
Re: valueof  
Jun 28, 2004 8:10 AM (reply 1 of 3)



 
Because there isn't any valueof(char) method in the String class.

You could try the valueOf(char) method, though.
 

Posts:24,036
Registered: 2/3/03
Re: valueof  
Jun 28, 2004 8:11 AM (reply 2 of 3)



 
valueOf()

Capitalization counts.
 

Posts:197
Registered: 02.09.97
Re: valueof  
Jun 28, 2004 8:14 AM (reply 3 of 3)



 
As you might know, or now going to learn right away the Java Language is case-sensitive. Every method-name, variable, datatype needs to be written exactly like you created it.

The static method you wanted to call is String.valueOf(char); mind the uppercase character "O" in valueOf.
 
This topic has 3 replies on 1 page.