| Author |
convert String to char
|
Robert Johnson
Ranch Hand
Joined: Feb 11, 2005
Posts: 32
|
|
|
how do you convert a string to a char
|
Whats in a name?
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24057
|
|
Assuming it's a one-character String, you just want String s = "a"; char a = s.charAt(0);
|
[Jess in Action][AskingGoodQuestions]
|
 |
Robert Johnson
Ranch Hand
Joined: Feb 11, 2005
Posts: 32
|
|
yea, that worked fine thanks. Do you know how to initialize a char variable? i.e, char letter = ?;
|
 |
Tim McGuire
Ranch Hand
Joined: Apr 30, 2003
Posts: 819
|
|
|
try a google search on "java define primitive types"
|
 |
 |
|
|
subject: convert String to char
|
|
|