Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java and JDK > BOOK: Beginning Java 2
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning Java 2
This is the forum to discuss the Wrox book Beginning Java 2, SDK 1.4 Edition by Ivor Horton; ISBN: 9780764543654
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Java 2 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 26th, 2004, 03:56 PM
Registered User
 
Join Date: Aug 2004
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default error on Chapter10

On page 402 of the book, there is a statement said buf.setPosition(8*doubleBuf.getPosition());
When I wrote this code to try to run, i got error. Also I checked Java API document, no method setPosition() or getPosition() for Buffer class. I don't know why these two methods showed in the book which confused reader.

  #2 (permalink)  
Old August 28th, 2004, 05:40 AM
Authorized User
 
Join Date: Sep 2003
Location: den Haag, , Netherlands.
Posts: 98
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by yc5x
 On page 402 of the book, there is a statement said buf.setPosition(8*doubleBuf.getPosition());
When I wrote this code to try to run, i got error. Also I checked Java API document, no method setPosition() or getPosition() for Buffer class. I don't know why these two methods showed in the book which confused reader.
That surely was careless of Ivor!
You have identified the error, and you read the SDK1.4 API docs - a good thing that you do! You must be able to find the right method to accomplish the task at hand. I am sure there is an alternative approach for this.

Happy wanderings!
Francis
Netherlands
  #3 (permalink)  
Old September 7th, 2004, 11:57 AM
Registered User
 
Join Date: Jun 2003
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for reporting that. Of course, the statement should have been:



buf.position(doubleBuf.position());



The position() method without a parameter returns the current position, and the version with a parameter sets the position to the integer value you pass as the argument and then returns a reference to the buffer object so you can use it to call another method for it.

Ivor
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
chapter10: reference not set... JohnBoy BOOK: Beginning VB.NET Databases 2 May 1st, 2006 05:34 AM
Chapter10: Select multiple nemenies sagh BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 1 September 22nd, 2005 04:34 PM
Another question on Chapter10 czambran BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 10 March 31st, 2005 03:11 PM
chapter10 yc5x BOOK: Beginning Java 2 1 August 28th, 2004 05:21 AM



All times are GMT -4. The time now is 08:00 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.