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

