返回列表 發帖
  1. package bbs.istak.org.tw;

  2. public class Main {

  3.         public static void main(String[] args) {
  4.                 Car bus = new Car();
  5.         bus.carname="公車";
  6.         bus.wheels=6;
  7.         bus.people=40;
  8.         System.out.printf("%s有%d個輪子,可載%d個人\r\n",bus.carname,bus.wheels,bus.people);
  9.         Car truck = new Car();
  10.         truck.carname="卡車";
  11.         truck.wheels=8;
  12.         truck.people=3;
  13.         System.out.printf("%s有%d個輪子,可載%d個人\r\n",truck.carname,truck.wheels,truck.people);
  14.         Car taxi = new Car();
  15.         taxi.carname="計程車";
  16.         taxi.wheels=4;
  17.         taxi.people=5;
  18.         System.out.printf("%s有%d個輪子,可載%d個人\r\n",taxi.carname,taxi.wheels,taxi.people);
  19.         }

  20. }
複製代碼
寶寶心裡苦,但寶寶不說。

TOP

返回列表