• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Not sure but seems to be a Typing error in SCJP6 book Page:441

 
Ranch Hand
Posts: 1087
Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not sure but seems to be a Typing error in SCJP6 book Page:441

public synchronized StringBuffer reverse()



in StringBuffer s is created as a reference variable,but when invoking the reverse method sb is being used and also for printing sb is being used.
 
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Vishal Hegde wrote:in StringBuffer s is created as a reference variable,but when invoking the reverse method sb is being used and also for printing sb is being used.



Why do you think that's an error?

And what happened when you tried the code, to confirm your assumptions before posting here?
 
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And why are they still using StringBuffer in a Java6 book?
 
Vishal Hegde
Ranch Hand
Posts: 1087
Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jeff Verdegan wrote:

Vishal Hegde wrote:in StringBuffer s is created as a reference variable,but when invoking the reverse method sb is being used and also for printing sb is being used.



Why do you think that's an error?

And what happened when you tried the code, to confirm your assumptions before posting here?



S refernce variable was created for StringBuffer Object refernce , but when calling the reverse method , its being refernced by sb(which is not defined ), and not S
 
Ranch Hand
Posts: 80
Hibernate Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is a Typo.
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Vishal Hegde wrote:
S refernce variable was created for StringBuffer Object refernce , but when calling the reverse method , its being refernced by sb(which is not defined ), and not S



Ah, ok. I didn't notice that.

Yes, it's a typo.
reply
    Bookmark Topic Watch Topic
  • New Topic