|
Answers to Readers' E-mail QuestionsThe following answers are in response to e-mail sent by readers. New (and newly updated) questions are presented first. Question: Would it be better to start with Java 1.1 or is that language obsolete now with Java 2 out? Answer: Though it's better to start out with Java 2 (currently in
version 1.4), about 75 percent of the material in Teach Yourself Java
1.1 Programming in 24 Hours is still relevant to the current version of
Java, though some of the methods in the book have been renamed in later
versions of the language. One example: size(), a method used
in applet windows and other places to figure out the size of the window, was
renamed getSize() later. Question: I can't load any of the source files from the CD, and none of the software listed in the Appendix is available. Is the CD incomplete? Answer: It sounds like your CD is defective -- the CD should
contain source files for all of the book's examples and all of the software
listed in Appendix E. Check what you have against the
full directory listing for the book's CD. Question: I'm stuck on page 25 of your book, where it states that I should go to the directory on my system containing BigDebt.java and type the javac BigDebt.java command. Where do I type this? Answer: If you're using Windows 95 or NT, you need to use the MS-DOS prompt when compiling Java 1.1 programs and running them with Appletviewer. Visit this site's online tutorial: Using the Java Development Kit on a Windows System for help with this feature. Question: How can I use a TARGET with the URL in the Hour 14 Revolve applet? Answer: In Line 75 of Listing 14.1 (Revolve.java), a URL is loaded with the following statement:
To load a URL with a TARGET, use a similar method that's outlined in Sun's java.net.URL documentation: showDocument(URL, String). The second argument of this method should be a string containing the name of the target. Question: On page 318 of Listing 24.2, I am a little confused with how lines 72-81 work. More specifically, I would like to know more about lines 75-76:
Answer: The Question: I'm using a Mac. Is there a developer's kit available for Macs that supports Java 1.1? Answer: Apple has released Mac Runtime for Java 2.1, which incorporates all of Java 1.1's functionality for running Java 1.1 programs, and the Mac Runtime for Java Software Development Kit 2.1. The Software Development Kit supports Java 1.1.8. For readers of this book and my subsequent Java 1.2 tutorials, I've set up a page about Java 1.2 availability on the Macintosh. Visit that page for the most current information I have. For other platforms, Sun lists the platforms that support the JDK on its site. Question: I can't seem to get the Answer: The key to using
This example will output the text "First Name: Abner", because Question: I'm having trouble getting the Java compiler to read my
Answer: Neither the Java Development Kit nor Supercede is likely to function correctly if there are other Java development tools on your system. What I would recommend at this point is to deinstall the JDK, deinstall Supercede, deinstall any other Java development tools you might have, and then reinstall JDK 1.1. The reason for this problem is that each Java development tool puts its own settings into the AUTOEXEC.BAT file, and this can make the other tools confused or inoperable. If you're a purchaser of the Java Starter Kit, you should note that the version of Supercede included with the Starter Kit does not support Java 1.1. The company released a subsequent version that supports 1.1 called Supercede Standard Edition 2.0.2, but that appears to be unavailable since Supercede's developer was purchased by Instantiations Inc. Question: Is there a list of all the built-in methods that Java supports? Answer: Sun offers full documentation for all classes in the Java language, including all public methods you can use. Visit the JDK 1.1 documentation page or go directly to the Core API Specification page to browse through the classes in HTML format. Question: When I save a file with Windows Notepad, it adds a .txt file extension to the filename, as in BigDebt.java.txt. How can I prevent this from happening? Answer: Put quote marks around the filename when you're saving it, as in "BigDebt.java". This prevents Notepad from adding the .txt file extension to the name. This problem does not occur under all Windows 95 configurations, but on those where it occurs, you won't be able to compile the program unless you rename it to take out the .txt file extension. Question: One of the figures in Hour 2 shows the Zeus programmer's text editor. Where can I get a copy of this program? Answer: Zeus for Windows, written by Jussi Jumppanen, is available for download from the software's official Zeus Web site. The software is a text editor designed specifically for use writing programs. It's available for Windows 95, Windows NT, Windows 3.1, and Windows for Workgroups. Question: In Hour 9, multidimensional arrays are introduced. Is
there a way to use the Answer: You can use
Question: I can't load any of the source files from the CD, and none of the software listed in the Appendix is available. Is the CD incomplete? Answer: It sounds like your CD is defective -- the CD should
contain source files for all of the book's examples and all of the software
listed in Appendix E. Check what you have against the
full directory listing for the book's CD. Question: I am trying to write a ping-pong game for two players and I am having some difficulties in applying some of the commands. Can you spare me some time and send some Java programing code for ping-pong with explanation? Answer: Although I can't tackle that programming project for you, I can point you to some great sites that offer Java games with source code for you to take a look at. First, you should visit Gamelan, Developer.Com's directory of Java resources. Many of its programs include source code. Second, you should check out the site of Karl Hörnell, the best Java game programmer on the planet. He includes source code for every game he hasn't sold to someone else. Question: When do you expect Java 1.1 standard to be supported by Netscape and Microsoft Web browsers? Answer: It only recently became available for some Web browsers. Here's the status of 1.1 support in Web browsers:
Question: I'm having trouble testing applets with Netscape Communicator. I changed and recompiled an applet, but when I went back to the browser and reloaded the page, it ran the old applet and showed me the source code for the new one. What's the problem? Answer: Browsers sometimes have trouble if you change an applet's class file while the browser is still loaded. They may run the old, cached copy of the class file instead of the new version you have just created. To clear this problem up, exit the browser and reload it. If you still have problems, delete all the temporary files in your browser's cache and then reload it again (or use Appletviewer while you're testing and debugging an applet). Question: I can't get the ClockTalk program to work under Visual J++. Am I doing something wrong? Answer: The problem is occuring because Visual J++ 1.1 does not include full support for Java 1.1. ClockTalk is the first program in the book that uses a feature of Java introduced with version 1.1. Because of that, readers will experience a problem if they're using a development tool other than the Java Development Kit, unless that tool supports Java 1.1. Microsoft has written some of its own features that replicate those of Java 1.1, but it's not close enough for you to be able to use Java 1.1 code without error using Visual J++. Visit the Visual J++ home page for more information. Question: Is the numeric range of the alphabet, from 65 for 'A' to 90 for 'Z', part of the basic Java language? If so, what are 1 through 64 reserved for? Answer: The numbers 1 through 64 include numerals, punctuation marks, and some unprintable characters such as linefeed, newline, and backspace. A number is associated with each printable character that can be used in a Java program, as well as some unprintable ones. Java uses the Unicode numbering system, which supports more than 60,000 different characters from the different languages of the world. The first 127 characters are from the ASCII character set, which you might have used in another programming language. Question: Where can I direct a tech question without having to spend money calling Sams Publishing long distance? Answer: Technical questions regarding the book and topics covered in the book can be sent to the author. Questions about software created by Sun's Java division such as the Java Development Kit can be addressed to the company through the Web site http://java.sun.com. However, you'll probably get faster results by posting a public message to the Usenet discussion newsgroup comp.lang.java.help or one of the other comp.lang.java.* newsgroups. |