Answer: Big Java is, well, bigger. It has additional chapters on
Answer:
Answer: If you are an
instructor, please visit
http://www.wiley.com/college/horstmann and select "Instructor
Resources". You will need to fill out a form and obtain a
password to see the solutions to all exercises.
Answer: Please contact my editor, Paul Crockett (pcrocket@wiley.com). He will be able to expedite the process.
Answer: If you use Windows, check out the excellent tutorial from Sun Microsystems. It goes through all the steps in excruciating detail.
Answer: The book uses Java 2 (i.e. SDK 1.2, 1.3, or 1.4)
Answer: The book code works with all Java 2 implementations, including the Mac running OS/X and Linux >= 2.2 with the Sun Java 2 SDK for Linux. It does not work with the Java 1 implementation on Mac OS/9.
Answer: No. Microsoft J++ and C# are not compatible with Java 2.
Answer: The book uses only standard Java. No additional libraries are required.
Answer: The book uses JOptionPane.showInputDialog for simple input. In the few cases that formatted output is required, I use NumberFormat.
Yes, you can. The book has been designed so that the graphics chapters can be safely skipped without disrupting the remainder of the course. Of course, there are quite a few exercises that use graphics, and you won't be able to assign them.
Answer: The book uses applets in its first graphics chapter, then switches to graphical applications and frames in its second graphics chapter. There is a simple reason. Applets require far less machinery than applications--no getContentPane, no super.paintComponent...
As an aside, from a business standpoint, the perception that applets are on their way out may not be entirely correct. I am aware of a good number of interesting and useful applet deployment projects for intranets. When download speed isn't an issue and low client administration cost is, then applets have a significant advantage. Also note that Java 2 has improved the applet security model which enables users more control over applet access privileges. (However, this book does not teach the security model.)
Superficially, it might seem easier to simply call
g.drawEllipse(x, y, w, h);
instead of
Graphics2D g2 = (Graphics2D)g;
Ellipse2D.Double egg = new Ellipse2D.Double(x, y, h, w);
g2.draw(egg);
Using an explicit object gives students more exposure to objects. After all, the purpose of the graphics chapter is ultimately not to have students draw pretty pictures with a minimum of code, but to teach them how to program with objects.
Answer: Painting directly on the surface of a JApplet is not recommended. Therefore I use the plain Applet class in chapter 4 and introduce JFrame and JApplet in chapter 10.
Answer: The show method of the Component class is indeed deprecated. However, JFrame inherits the show method of the Window class which is not deprecated. That method makes the window visible and brings it to the front. For that reason, calling show() is superior to calling setVisible(true).
Answer: Using inner classes for all event handlers has one great advantage: consistency. For that reason, most user interface builders use inner classes for all events. Java programs that are programmed by hand tend to use inner classes only for event adapters, which leads to different styles for handling action events, mouse events, and window events. Event handling is hard enough for beginners. Using a consistent style really helps clarify the process.
Answer: The javac compiler sends error messages to the standard error stream, not the standard output stream. Unfortunately, the Windows shell does not allow redirection of the standard error stream to a file.
Remedy: Use the errout.exe program to redirect the standard error stream to the standard output stream:
errout javac MyProg.java | more
errout javac MyProg.java > errors.txt
This is a simple C program--source code below:
#include <io.h>
#include <stdio.h>
#include <process.h>
int main(int argc, char* argv[])
{
dup2(1, 2); // make stderr go to stdout
execvp(argv[1], argv + 1);
return 0;
}
Or, if you prefer a pure Java solution, compile the following Java class:
import java.io.*;
public class Errout
{
public static void main(String[] args) throws IOException
{
Process p = Runtime.getRuntime().exec(args);
BufferedReader err
= new BufferedReader(new InputStreamReader(p.getErrorStream()));
String line;
while ((line = err.readLine()) != null)
System.out.println(line);
}
}
Then execute the following command:
java Errout javac MyProg.java | more
java Errout javac MyProg.java > errors.txt
Answer: You would want to do this if your integrated development environment immediately closes a console application when it has completed, giving you no chance to admire the output.
The following method always works. Add these lines to the end of your program:
System.out.println("Hit ENTER to exit.");
try { System.in.read(); } catch (IOException e) {}
Answer: Here are directions for Windows 95/NT.
I don't have information for other operating systems, but I will gladly publish them if someone lets me know.