hi

im constructing a rectangle in main method, i wrote:

rectangle t = new rectangle();

but i get message on compilation:

cannot find symbol
symbol:constructor retcangle()
location:class rectanlge()
                   rectangle t = new rectangle();
                                      ^

what is wrong?

Recommended Answers

There are a few things that could be the problem.

My first guess is that the class is actually a Rectangle instead of a rectangle.

Second, the Rectangle class might not have a zero parameter constructor. It might only have a constructor of Rectangle(int length, int width).

Jump to Post

All 3 Replies

There are a few things that could be the problem.

My first guess is that the class is actually a Rectangle instead of a rectangle.

Second, the Rectangle class might not have a zero parameter constructor. It might only have a constructor of Rectangle(int length, int width).

Third, from your post, unless you didn't cut and paste, there is a typo with the constructor found by this error: symbol:constructor retcangle().

Regards,

Nate

so if i am missing the parameters from the class how do i write it in the construting object. and how do i knw how many parameters i have

If the Rectangle class your's? If so, can you post the class? If the class isn't your's there should be generated java doc for that class that explains how to use the class.

Regards,

Nate

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.