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 May 20th, 2004, 07:48 AM
Registered User
 
Join Date: May 2004
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
 
Old May 27th, 2004, 03:03 AM
Authorized User
 
Join Date: Sep 2003
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





 
Old May 29th, 2004, 02:47 PM
Authorized User
 
Join Date: Sep 2003
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

 
Old June 1st, 2004, 07:47 AM
Registered User
 
Join Date: May 2004
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





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





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