Frequently Asked Questions

This document contains answers to some frequency (and infrequently) asked questions.

General Questions

When will the textbook be published? The first four chapters are published as an Introduction to Programming in Java: An Interdisciplinary Approach by Addison Wesley. If you're a faculty member considering adoption, please fill out the form from the booksite homepage.

Why Java? Why not C or C++ or C# or Python or Ruby or Matlab? The program that we are writing are very similar to their counterparts in several other languages, so our choice of language is not crucial. We use Java because it is widely available, widely used, embraces a full set of modern abstractions, and has a variety of automatic checks for mistakes in programs, so it works well for students learning to program. There is no perfect language and you certainly will find yourself programming in other languages in the future.

Do I need previous programming experience? No, this textbook starts from the beginning. If you have prior programming experience, you can move through Chapter 1 at a more rapid pace, but you are likely to find the examples worthy of careful study.

Do I need any special math or science background? No, we assume only a basic high school background. Our approachreinforces and takes advantage of students' preparation in high-school math and science as they learn programming.

I discovered what I think is a typo or error. Who should I contact? Please check the errata list and fill out a bug submission form. We appreciate your feedback.

Are there solutions to all of the exercises? No, we've linked to the ones we have written. Feel free to contribute to the community and submit a solution to one of the exercises.

I'm an instructor. Can I use your material for my class? If you adopt the book, you are free to use and adapt any of the material for your needs. Otherwise, please email the authors to request permission.

How can I contact the authors? Email Kevin Wayne.

Which textbook do you recommend for CS 2 course? We highly recommend the companion textbook Algorithms, 4th Edition.


What version of Java are you using? Java 1.5 (aka Java 5) or newer.

Who designed Java? James Gosling. Here is an interview, where he discusses some of the thoughts that went into including and not including certain features of Java.

Is there an official specification of the Java language? Yes, but it's quite technical. Here is the Java Language and Virtual Machine Specifications.

Where can I find documentation for the Java libraries? Here is documentation for all Java 8 classes. As you become a more proficient Java programmer, this will become an essential reference.

Can you recommend a good intermediate-level book on Java? Check out Oracle's online Java Tutorial for an introduction to advanced Java features not covered in our textbook. Joshua Bloch's Effective Java is a "must-read" for any intermediate to advanced Java programmer.

I've programmed in C before. Can you offer any help on transitioning? Here's a comparison table.

Is there a good integrated development environment for novices? We recommend Dr. Java. More sophisticated IDEs, such as Eclipse, are overkill for an intro course, but are widely used by professional programmers.

Should I use a debugger? Reasonable people disagree on this one. Our preference is not to use a debugger when first learning to program.

Are there tools for detecting common bugs? FindBugs is one such tool that we recommend. You can test it out using their Webstart application.

Is there a list of Java error messages? Here's an index of compile-time error messages and their likely causes. Here's an index of run-time error messages and their likely causes.

Is there an open source version of the Java libraries? Yes, OpenJDK. Here's a good description of open source software.

How do I set the classpath? The classpath is an environment variable which javac and java use to find the location of any needed .class files. This would enable you to put StdDraw.class, StdIn.class, and other commonly used libraries and they would always be available. By default, the classpath is the current working directory. If your classpath has already been set, you may need to change it to make it include the current working directory. Here's a wealth of classpath info. It can be rather confusing.

When I compile with javac it says that one of the methods I use is deprecated. What does that mean? A deprecated method is method that was supported in older versions of Java, but is now obsolete. You should use the suggested replacement method instead, since the deprecated method may not be supported in future versions of Java.

How does Java compare in terms of speed to C or C++? To Perl or Python? The answer depends greatly on the type of application you're running. As a rule of thumb, Java's performance is good, C and C++ are blazingly fast, and Perl/Python are slow. This article claims that Java is comparable to C for scientific applications involving number crunching. No benchmark is perfect, but The Computer Language Shootout Benchmarks is a good starting point.

Are there are common pitfalls that I should be aware of? Here's a worthwhile list of common Java gotchas.

Does Java have pointers? Java doesn't have raw pointers like C or C++, but it has references which are almost as powerful, but much safer. Here's a good summary of the differences. The Java Virtual Machine itself can implement references with pointers (for raw speed) or with handles (for more flexible memory management).

Can I write AJAX applications like Google Maps and Gmail in Java? Yes, check out the Google Web Toolkit.

Creating the Booksite

The program links contain syntax-highlighted versions of the code. How was this accomplished? We use GNU source-highlight to automatically produce the syntax-highlighted versions.

How did you create the screen output drawings in the textbook? We used our standard drawing library described in the textbook.