• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Kathy's Book pg 366

 
Prem Mander
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i was just wondering if the method abt reversing string using string buffer's reverse method on pg 366 of her book , the example given there
"StringBuffer sb = new StringBuffer("A man a plan a canal Panama");
System.out.println(sb);//output is"amanaP lanac a nalp a nam A"
is it how it behaves or was it an error
???
 
Sridhar Srikanthan
Ranch Hand
Posts: 366
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Prem,
I tried and its working normally. What i can suggest is to delete your .class file and recompile your program
Regards
Sri
 
Prem Mander
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi sri
thanks for u r instant reply, but was just wondering if you happen to read the pg 366 of kathy's book
Prem
may be you would than understand what i meant
 
Bert Bates
author
Sheriff
Posts: 8900
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Prem -
Good catch ! Obviously the second line of code should be:
sb.reverse();
We'll add this one to the errata ! :roll:
-Bert
(falling on his sword ...)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic