• 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
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
Bartenders:

Sybex CSG 17/Sybex 829: Method signature is missing void keyword in table 14.11 on page 839

 
Greenhorn
Posts: 5
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Table 14.11 on page 839 lists a method signature that marks the current position in a stream as follows:

This version is correct:
 
Marshal
Posts: 78698
374
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch

But that isn't the method signature; the signature of that method is mark(int). The modifiers and return type don't form part of the signature.
 
Master Rancher
Posts: 4661
63
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
True, though beside the point.  Does the book refer to this as a "signature", I wonder?  Hopefully not.  Regardless, if they're showing the "public" part, they should be showing "void" as well.
 
Konstantin Müller
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are both right. I was wrong. It isn’t the signature because they are showing the public modifier everywhere.

This is how the table (TABLE 14.11: Common I/O stream methods) looks like:

Method nameDescription
public boolean markSupported()Returns true if stream class supports mark()
public mark(int readLimit)Marks current position in stream
public void reset()Attempts to reset stream to mark() position
public long skip(long n)Returns and discards specified number of characters
 
Campbell Ritchie
Marshal
Posts: 78698
374
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would say the last method description is a bit confusing. If you look up InputStream#skip(long), you will find that you pass the number of bytes you want to skip, and the method returns the number of bytes actually skipped, which might be different. More information in that link.
 
Mike Simmons
Master Rancher
Posts: 4661
63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Good point.  It is a very brief summary, designed for limited space.  But the "returns" part is just plain wrong - it doesn't return any skipped characters.  Perhaps "Attempts to skip past the specified number of characters" would be better.  Don't mention the return unless you can say what it's returning.
 
author & internet detective
Posts: 41775
887
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Confirmed and added to errata. The intent was definitely to include void there; just like we did on the next line for reset()
 
No, tomorrow we rule the world! With this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic