Could be version Problem

HEllo,

I have started learning java and I an encountering an issue here.

I am using the following code from one us the Java Tutorials, from Sun Website.

publicclass CreateObjectDemo{

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.area());

//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);

}

}

The problem is that tutorial is not telling me to import the Point and Rectangle Classes, but when I use this program in my Eclipse IDE, it tells me to import, so I import the files.

After that also the it is not allowing me to use

Rectangle rectOne =new Rectangle(originOne, 100, 200);

It says Constructor Rectangle(Point, int, int) is not defined.

This very Much Clear as I have checked teh API, this constructor is not defined.

or

System.out.println("Area of rectOne: " + rectOne.area());

it says method area() is not defined.

This very Much Clear as I have checked teh API, this method is not defined.

Now, I am wondering if I am using the wrong version of java, if so, how can I check, I am using jdk1.5.0_06

But the version should not be a problem as I am looking at the following version of API JavaTM 2 Platform Standard Ed. 5.0, and Tutorial is following JDK5.0

I did paste this issue on Tutorial's feed back, but I have not herd from them.

If any one can tell what is confliciting, and how should it be resolved, it will be very much appreciated.

Just direct me to the right direction.

Regards

[3238 byte] By [Underdoga] at [2007-10-3 2:48:37]
# 1

I have checked the License file and it says the following:

Sun Microsystems, Inc. Binary Code License Agreement

for the JAVA 2 PLATFORM STANDARD EDITION DEVELOPMENT KIT 5.0

Therefore I think I am using the right version, or am I checking the wrong thing?

Regards

UnderDog

Underdoga at 2007-7-14 20:37:24 > top of Java-index,Java Essentials,Java Programming...
# 2

Sorry Guys, when I go further in the tutorial, things have become clear.

The Point and the Rectangle classes are not the one that are in AWT package, they are user defined which the aurthor of the Tutorial is defining later in the chapter.

Anyways, Thank you for your time and having a look at it.

Underdoga at 2007-7-14 20:37:24 > top of Java-index,Java Essentials,Java Programming...