Okay, so I'm very new to Java, and I have no prior programming experience. I'm going through the Java tutorial, and everything is going alright until I run into a problem in the "Objects" section the tutorial.
The title of the program is Create Object Demo. The goal is to find the width, height, and area of one rectangle, and the new position of another. You do all of this using the premise of "Creating an object." The creating the object part is the problem.
Here's the original code:
public class CreateObjectDemo { public static void 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); } } I run the program, and this is my error message:
CreateObjectDemo:.java:6: error: cannot find symbol Point originOne = new Point(23, 94); ^ symbol: class Point location: class CreateObjectDemo CreatObjectDemo.java:6: error: cannot find symbol Point originOne = new Point(23, 94); ^ The full code and process is also located here
Likewise, the error message points to the word "Point" and "Rectangle" in the same fashion and claims that it "cannot find [the] symbol."
Any help would be greatly appreciated. I've been struggling with this error for a couple of days now. Thanks.
importstatements as appropriate, and then include them in your classpath when you compile. That particular error is the compiler saying, "Wait, you're referencing these classes but I don't know what they are!"