Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 26th, 2004, 03:56 PM
Registered User
 
Join Date: Aug 2004
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.

 
Old August 28th, 2004, 05:40 AM
Authorized User
 
Join Date: Sep 2003
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
 
Old September 7th, 2004, 11:57 AM
Registered User
 
Join Date: Jun 2003
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





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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.