I've purchased "The Java Tutorial, Third Edition" . It was written for the j2sdk1.3 compiler. Iv'e downloaded j2sdk1.4_05 into FC2. Will the newer compiler not always work with the examples in the book? I'm working on a example called "CreateObjectDemo" that
creates a rectangle. The code:
Point origin_one = new Point(23, 94);
Rectangle rect_one = new Rectangle(origin_one, 100, 200);
Rectangle rect_two = new Rectangle(50, 100);
When I run javac the compiler gives me an error message that states:
"cannot resolve symbol"
It points to each Point and each Rectangle for 6 errors.
Here's the whole program:
public class CreateObjectDemo {
public static void main(String[] args) {
// Declare and create a point object and two rectangle objects
Point origin_one = new Point(23, 94);
Rectangle rect_one = new Rectangle(origin_one, 100, 200);
Rectangle rect_two = new Rectangle(50, 100);
// Display rect_one's width, height, and area
System.out.println("Width of rect_one: " + rect_one.width);
System.out.println("Height of rect_one: " + rect_one.height);
System.out.println("Area of rect_one: " + rect_one.area());
// Set rect_two's position
rect_two.origin = origin_one;
// Display rect_two's position
System.out.println("X Position of rect_two: " + rect_two.origin.x);
System.out.println("Y Position of rect_two: " + rect_two.origin.y);
// Move rect_two and display its new position
rect_two.move(40, 72);
System.out.println("X Position of rect_two: " + rect_two.origin.x);
System.out.println("Y Position of rect_two: " + rect_two.origin.y);
}
}
I guess I just need to know if I should use j2sdk1.3. It's on the disk that came with the book.
The compilers are not backward compatible? Sorry for the dumb newbie problem.
Thanks in advance -- Larry