Java application doesn't display output

Here's my updated 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; public void speedUp(int Increment) { speed = speed + Increment;} public void applyBrakes(int Decrement) { speed = speed - Decrement;} public void changeRpm(int NewValue) { rpm = NewValue;} public void changeGear(int NewValue) { gear = NewValue;} public void printStates() { System.out.println("speed:"+speed+" rpm:"+rpm+" gear:"+gear);} } class CarDemo{ 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(); } } } } The application will not display the output. I have no idea what to do. Any advice?

以上就是Java application doesn't display output的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏