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
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 May 20th, 2004, 07:48 AM
Registered User
 
Join Date: May 2004
Location: , NY, USA.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to DRAYKKO Send a message via Yahoo to DRAYKKO
Default Chapter 4 Errors?

I noticed a couple of errors while working through some of the samples in Chapter 4 of this book:

1. On page 123 the Unicode character \U03C0 doesn't generate Pi as the book says, but rather the character "?".

2. On page 125 the following code generates an error when I use the NetBeans editor:

   if(anyString == null)
     System.out.println(...)


The error is: non-static variable anyString cannot be referenced from a static context
        if(anyString == null)


Is there a site that lists Unicode characters and is there a correction for that "non-static..." error?

Dre---
---------------------------------

That which does not kill me makes me stronger
  #2 (permalink)  
Old May 27th, 2004, 03:03 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 DRAYKKO



1. On page 123 the Unicode character \U03C0 doesn't generate Pi as the book says, but rather the character "?".
1. The ? means your system does not recognize the unicode character.
The display of unicode depends on the local machine implementation.
You can make a test loop to see what can be displayed and what characters are out of reach for your system. E.g.

for(int i = 0; i < 256; i++)
    System.out.println(i + " " + (char)i);

Quote:
quote:
2. On page 125 the following code generates an error when I use the NetBeans editor:

if(anyString == null)
     System.out.println(...)


The error is: non-static variable anyString cannot be referenced from a static context
        if(anyString == null)
2. This happens quite often, and is not hard to fix. The problem is that you are calling an instance variable from a static context, e.g. the static method main().
Here you can either take care that:
- anyString is static
- the method that calls anyString is an instance method

This will improve your programming structure.

Frans





  #3 (permalink)  
Old May 29th, 2004, 02:47 PM
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 DRAYKKO


1. On page 123 the Unicode character \U03C0 doesn't generate Pi as the book says, but rather the character "?".

Is there a site that lists Unicode characters and is there a correction for that "non-static..." error?
http://www.unicode.org
but as I said before: its the local system's implementation of the unicode that is decisive here

  #4 (permalink)  
Old June 1st, 2004, 07:47 AM
Registered User
 
Join Date: May 2004
Location: , NY, USA.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to DRAYKKO Send a message via Yahoo to DRAYKKO
Default

Thanks for the help! I'll try the code to define the Unicode characters.

Dre---
---------------------


That which does not kill me makes me stronger
 


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
Chapter 16 - Errors - Need Help Please CoopersWorld BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 0 June 14th, 2008 11:00 AM
More Errors in chapter 7..... rollercoaster BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 5 October 3rd, 2006 03:49 PM
Chapter 6 Try It Out errors Voltron ASP.NET 2.0 Basics 0 August 9th, 2006 01:42 AM
More on Chapter 7 DataList Try It Out errors VictorVictor BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 2 April 27th, 2006 12:26 PM



All times are GMT -4. The time now is 05:46 AM.


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