Welcome to the Big Java/Computing Concepts with Java Essentials FAQ!

{short description of image}

Question: What is the difference between Big Java and Computing Concepts with Java Essentials, Third Edition?

Answer: Big Java is, well, bigger. It has additional chapters on

Question: What are the buildings on the book covers?

Answer: The Java Essentials cover shows a photo of the temple Prambanan in Central Java, Indonesia. The Big Java cover is an artist's rendering that was inspired by the same temple. Prambanan is the biggest temple complex in Java, with over 200 Hindu temples that were constructed around 900 CE.

Question: What are the most important changes in the third edition?

Answer: 

Question: How can I get the solutions to the exercises?

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. 

Question: I am an instructor and put in a request to access the instructor resources, but nothing happened. 

Answer: Please contact my editor, Paul Crockett (pcrocket@wiley.com). He will be able to expedite the process. 

Question: I am getting weird errors when compiling even the simplest programs. I tried everything, and it still doesn't work.

Answer: If you use Windows, check out the excellent tutorial from Sun Microsystems. It goes through all the steps in excruciating detail.

Question: What version of Java does the book use?

Answer: The book uses Java 2 (i.e. SDK 1.2, 1.3, or 1.4)

Question: Does the book code work with the Mac? Linux?

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.

Question: Does the book code work with J++ or C#?

Answer: No. Microsoft J++ and C# are not compatible with Java 2.

Question: Does the book use standard Java only, or do I need to use an additional library?

Answer: The book uses only standard Java. No additional libraries are required. 

Question: How can you do input and formatted output without additional libraries?

Answer: The book uses JOptionPane.showInputDialog for simple input. In the few cases that formatted output is required, I use NumberFormat.

Question: I want to teach programming concepts, not graphics. Can I skip the graphics chapters?

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.

Question: Why are you using applets? Aren't applets on their way out?

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.)

Question: Why are you using the Graphics2D and Ellipse2D classes? What is wrong with the drawEllipse method?

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.

Question: Why are you using the Applet class? Shouldn't you use JApplet in Java 2?

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.

Question: Why are you using the show method for objects of the JFrame class? Don't you know it is deprecated and that you are supposed to use setVisible(true)?

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).

Question: Why are you using inner classes for event handling?

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.

Question: Chapter 23 recommends using the Cloudscape database, but it is no longer freely available. What do you recommend as a replacement?

Answer: You may be able to get the software for free through the IBM Scholar's Program. Or try the open source McKoi SQL or Hypersonic SQL or the commercial PointBase (free demo only).

Question: I am using javac under Windows, and my program has so many errors that they all flash by and I can only see the last few. I even tried redirection (javac MyProg.java | moreor javac MyProg.java > errors.txt), and it doesn't work.

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

Question: How can I make a console program pause before quitting?

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) {}

Question: How can I print my homework?

Answer: Here are directions for Windows 95/NT.

  1. If your program is a graphics program, then run it and take a screen snapshot by hitting Alt+Print Screen. Paste the graphics into a paint program (such as MS Paint) or word processor by typing Ctrl+V, then print it.
  2. If your program is a text program, and the input and output fits on a single screen, you can use the same method for taking a screen snapshot of a DOS shell window.
  3. If your program has no input but lots of output, you can redirect the output to a file (see Productivity Hint 6.1) and then print the output file. But that doesn't work if you also need type input because you won't see the prompts.
  4. If your program has both lots of input and output, use a better command shell than the built-in DOS shell. For example Emacs shell mode works well.

I don't have information for other operating systems, but I will gladly publish them if someone lets me know.