java - 抽象类计算三角形和矩形面积周长,这个红色警告线是哪里报错了???
PHP中文网
PHP中文网 2017-04-18 10:50:23
0
2
929

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(2)
大家讲道理

I guess it’s because there is no definition TriangleRectangle这两个类.
你可以把光标移动到红色警告先,看是不是弹出 Triangle cannot be resolved to a typeRectangle cannot be resolved to a type, if so, that’s why I said it.
Suggestion: Move the cursor to the error yourself, F2, and look at the pop-up information.

大家讲道理

There is only a red line under the class name because the class is not defined.

But seeing that you have two files, Triangle.java and Rectangle.java, you should have written these two classes.
So I guess there are two reasons:

  1. There is a spelling error in your class name. Although the probability of the two class names being spelled incorrectly is very small, this situation cannot be ruled out;

  2. Your Triangle and Rectangle classes are not in the same package as the Test2 class, and you did not import them in Test2.

In fact, it is best to move the cursor to the error yourself as @taomaokun said and press F2 to see the pop-up information.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template