Hello everyone,
I'm writing for the
SCJP 310-055,
I've been trying to figure out why this code gives me as output: ..azba
how the f was removed??
I hope to get an answer to this little "code", that would help me a lot
Thanks very much!
class Polish{
public static void main(
String []args){
int x = 4;
StringBuffer sb = new StringBuffer("..fedcba");
sb.delete(3,6);
sb.insert(3, "az");
if (sb.length()>6) x = sb.indexOf("b");
sb.delete((x-3), (x-2));
System.out.println(sb);
}
}
[ April 11, 2008: Message edited by: James O'connor ]