|
Java™ by example!
|
|
|
How do I get a single character from a String?
Use the method charAt in the String class. It will return the character at that position or throw the Exception StringIndexOutOfBoundsException if index < 0 or > than the length of the string. Example:
 System.out.println("Hello, world!".charAt(1)); // prints out "e"
|
Further Information
Author of answer: unknown
Comments to this answer are only viewable by members. Login or become a member!
|
|
|
|
|