Possible Duplicate:
Java application doesn't display output
I am learning the basics of Java development so that I can get into Android development. In this very simple application I'm running into some problems. It's supposed to give me an output of the cars speed, gears, rpm and so forth. I can compile the application no problem but when I go to run it it doesn't display the output. What could the problem be? Here's the code:
package car1;
public class Main {
public static void main(String[] args) {
class HondaCivic implements car1 {
int speed = 0;
int rpm = 0;
int gear = 1;
void speedUp(int Increment) {
speed = speed + Increment;}
void applyBrakes(int Decrement) {
speed = speed - Decrement;}
void changeRpm(int NewValue) {
rpm = NewValue;}
void changeGear(int NewValue) {
gear = NewValue;}
void printStates() {
System.out.println("speed:"+speed+" rpm:"+rpm+" gear:"+gear);
}
}
class Car1{
public void main(String[] args) {
// Two different Cars
HondaCivic car1 = new HondaCivic();
HondaCivic car2 = new HondaCivic();
// Methods for cars
car1.speedUp(30);
car1.changeGear(3);
car1.changeRpm(3000);
car1.applyBrakes(15);
car1.printStates();
car2.speedUp(30);
car2.changeGear(3);
car2.changeRpm(2000);
car2.applyBrakes(15);
car2.speedUp(5);
car2.changeGear(1);
car2.printStates();
}
}
}
}
}