cannot find symbol - constructor Car() [closed]
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 questionI'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.
精彩评论