public class CarTester {
public static void main (String[] args)
{
Car myMysteryMachine = new Car (1000); // Car gets 1000 miles per gallon
myMysteryMachine.addGas(20); // 20 gallons of gas are added to the tank
myMysteryMachine.drive(100); // Driving the car 100 miles
System.out.println(myMysteryMachine.getGasInTank()); // Method prints the remaining fuel
}
}
TigerTeck
0
Light Poster
Recommended Answers
Jump to PostHave you declared a constructor Car(int) ?
When you get: "cannot find symbol" it is usually because you are using a method or class that doesn't exist.
Meaning that you either haven't imported the class or you are calling the method/constructor with the wrong arguments or return type, …
All 3 Replies
TigerTeck
0
Light Poster
javaAddict
900
Nearly a Senior Poster
Team Colleague
Featured Poster
NormR1
563
Posting Sage
Team Colleague
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.