开发者

cannot find symbol - constructor Car() [closed]

Closed. This question needs debugging details. It is not currently accepting answers.

Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This wil开发者_运维知识库l help others answer the question.

Closed 3 years ago.

Improve this question

I'm trying to use a method from another class called Car but referring to it in a class called Bike. I've tried to create an instance variable by using the following code

Car b = new Car();
b.higherLease

It just keeps coming up with error: cannot find symbol - constructor Car() The car class works perfectly though. ANy help is greatly appreciated. Thanks


make sure the class is public (or protected if in the same package). you can check to see if it recognise the Car class by defining a static method foo and then calling Car.foo(); from Bike.


Make sure you have imported the class Car. You can import by adding this line after the package statement.

import yourclass; // fully qualified class name.

But you need to get ide like eclipse or something which does it automatically.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜