*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Kathy's Book  pg 366 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Kathy Watch "Kathy New topic
Author

Kathy's Book pg 366

Prem Mander
Greenhorn

Joined: Nov 06, 2001
Posts: 16
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

Joined: Jan 08, 2003
Posts: 366
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

Joined: Nov 06, 2001
Posts: 16
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

Joined: Oct 14, 2002
Posts: 8801
    
    5
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 ...)


Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Kathy's Book pg 366
 
Similar Threads
doubt with StringBuffer
Please explain me ? StringBuffer
String Buffer
a simple quiz on string equals
Can anybody explain this?