public class Count{ int countValue; Count(){ countValue=0; } public void increment() { countValue++; } public void decrement() { countValue--; } public void reset() { countValue=0; } public int getCountValue(){ return countValue; } public static void main(String args[]){ Count c = new Count(); c.increment(); System.out.println(c.getCountValue()); c.reset(); System.out.println(c.getCountValue()); } } 運行結果: 1 0
采納哦
上一篇:自動發卡平臺支付通道怎麽弄的下一篇:如何為Tik Tok的餐館做團購?