X1099: Debugging Scope- Conditionals

The Rectangle class below has two integer fields to store its length and width. The toString() method should do the following:

  • If the area of the rectangle is less than 20, it should return "this is a small rectangle".
  • If the area of the rectangle is greater than 30, it should return "this is a big rectangle".
  • Otherwise, it should return an empty string ("").

However, something in the toString() method is not working correctly. Fix the toString method.

Your Answer:

Reset

Practice a different Java exercise

Feedback

Your feedback will appear here when you check your answer.