返回列表 發帖
  1. package mhjh.mtc;

  2. public class Main {

  3.         public static void main(String[] args) {
  4.                 // TODO 自動產生的方法 Stub
  5.        Account amy =new Account ();
  6.        amy.money=100;
  7.        Account bob = new Account ();
  8.        bob.money=100;
  9.        System.out.println("Amy買了熱狗花了三十元");
  10.        amy.money-=30;
  11.        System.out.println(String.format("Amy剩下%d元",amy.money));
  12.        System.out.println(String.format("Bob剩下%d元",bob.money));
  13.       
  14.        System.out.println("Bob努力工作賺了100元");
  15.        bob.money+=100;
  16.        System.out.println(String.format("Amy剩下%d元",amy.money));
  17.        System.out.println(String.format("Bob剩下%d元",bob.money));
  18.       
  19.         }

  20. }
複製代碼

TOP

  1. package mhjh.mtc;

  2. public class Account {
  3.    int Account;
  4.    static int money;
  5.    
  6. }
複製代碼

TOP

返回列表