Return | Method | Summary |
---|---|---|
char | charAt(int index) | Returns the char value in this sequence at the specified index. |
void | setCharAt(int index, char ch) | The character at the specified index is set to ch. |
void | getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin) | Characters are copied from this sequence into the destination character array dst. |
public class Main {
public static void main(String[] argv) {
StringBuilder sb = new StringBuilder();
sb.append("java2s.com");
char ch = sb.charAt(0);
System.out.println(ch);
}
}
The output:
j
public class Main {
public static void main(String[] argv) {
StringBuilder sb = new StringBuilder();
sb.append("java2s.com");
sb.setCharAt(0, 'J');
System.out.println(sb.toString());
}
}
The output:
Java2s.com
java2s.com | Contact Us | Privacy Policy |
Copyright 2009 - 12 Demo Source and Support. All rights reserved. |
All other trademarks are property of their respective owners. |