Another simple question learning java from sum.com
Dear all,
1st thanks for help from all of you. Here is the question. I am learning 'Object' from http://java.sun.com/docs/books/tutorial/java/javaOO/objects.html. Please help me to find out the problem
1. I create a project called object01
2. I download Point.java and Rectangle.java under folder C:\Users\Marco\object01\src\object01
3. Then copy and paste the code from the web
package object01;
publicclass Main{
publicstaticvoid main(String[] args){
//Declare and create a point object
//and two rectangle objects.
Point originOne =new Point(23, 94);
Rectangle rectOne =new Rectangle(originOne, 100, 200);
Rectangle rectTwo =new Rectangle(50, 100);
//display rectOne's width, height, and area
System.out.println("Width of rectOne: " +
rectOne.width);
System.out.println("Height of rectOne: " +
rectOne.height);
System.out.println("Area of rectOne: " + rectOne.getArea());
//set rectTwo's position
rectTwo.origin = originOne;
//display rectTwo's position
System.out.println("X Position of rectTwo: "
+ rectTwo.origin.x);
System.out.println("Y Position of rectTwo: "
+ rectTwo.origin.y);
//move rectTwo and display its new position
rectTwo.move(40, 72);
System.out.println("X Position of rectTwo: "
+ rectTwo.origin.x);
System.out.println("Y Position of rectTwo: "
+ rectTwo.origin.y);
}
}
error message is
init:
deps-jar:
Compiling 1 source file to C:\Users\Marco\object01\build\classes
C:\Users\Marco\object01\src\object01\Main.java:23: cannot access object01.Point
bad class file: C:\Users\Marco\object01\src\object01\Point.java
file does not contain class object01.Point
Please remove or make sure it appears in the correct subdirectory of the classpath.
Point originOne = new Point(23, 94);
1 error
[2747 byte] By [
marco_wua] at [2007-11-27 7:05:14]

I follow your instruction, add the code, but still have this error message
init:
deps-jar:
Compiling 1 source file to C:\Users\Marco\object01\build\classes
C:\Users\Marco\object01\src\object01\Main.java:23: cannot access object01.Point
bad class file: C:\Users\Marco\object01\src\object01\Point.java
file does not contain class object01.Point
Please remove or make sure it appears in the correct subdirectory of the classpath.
Point originOne = new Point(23, 94);
1 error
I deleted the 2 files (Point.java and Rectangle.java) from C:\Users\Marco\object01\src\object01
New error message coming up
init:
deps-jar:
Compiling 1 source file to C:\Users\Marco\object01\build\classes
C:\Users\Marco\object01\src\object01\Main.java:24: cannot find symbol
symbol : constructor Rectangle(java.awt.Point,int,int)
location: class java.awt.Rectangle
Rectangle rectOne = new Rectangle(originOne, 100, 200);
C:\Users\Marco\object01\src\object01\Main.java:32: cannot find symbol
symbol : method getArea()
location: class java.awt.Rectangle
System.out.println("Area of rectOne: " + rectOne.getArea());
C:\Users\Marco\object01\src\object01\Main.java:35: cannot find symbol
symbol : variable origin
location: class java.awt.Rectangle
rectTwo.origin = originOne;
C:\Users\Marco\object01\src\object01\Main.java:39: cannot find symbol
symbol : variable origin
location: class java.awt.Rectangle
+ rectTwo.origin.x);
C:\Users\Marco\object01\src\object01\Main.java:41: cannot find symbol
symbol : variable origin
location: class java.awt.Rectangle
+ rectTwo.origin.y);
C:\Users\Marco\object01\src\object01\Main.java:46: cannot find symbol
symbol : variable origin
location: class java.awt.Rectangle
+ rectTwo.origin.x);
C:\Users\Marco\object01\src\object01\Main.java:48: cannot find symbol
symbol : variable origin
location: class java.awt.Rectangle
+ rectTwo.origin.y);
Note: C:\Users\Marco\object01\src\object01\Main.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
7 errors
BUILD FAILED (total time: 0 seconds)