hi
When I compile the following code it compiles ok
<code>class CharTest{
public static void main(
String args[]){
StringBuffer s=new StringBuffer("'\u0061'");
System.out.println(s);
s.setCharAt(5,'A');
System.out.println(s);
}
}</code>
But when I run it I get the following runtime exception;Why is it?
'a'
Exception in
thread "main" java.lang.StringIndexOutOfBoundsException: String ind
ex out of range: 5
at java.lang.StringBuffer.setCharAt(StringBuffer.java:345)
at CharTest.main(Compiled Code)
------------------