當前位置:編程學習大全網 - 電腦編程 - 編程荒島求生

編程荒島求生

寫壹個電池(Cell):有品牌屬性,可以續費。公有類單元格{私有字符串品牌;公共字符串get brand(){ return brand;}public void setBrand(字符串品牌){ this.brand = brand}Cell(字符串品牌){ this.brand = brand} public void relay () {system。out.println("更新動力。");}}寫壹個測試類(test cell)import javax . swing . cell editor;Public類test cell { public static void main(string[]args){ cell cell = new cell(" big battery ");System.out.println("測試結果:"+cell . get brand());cell . relay();}}
  • 上一篇:常州恐龍園買票玩要花錢嗎?
  • 下一篇:洛谷可以交朋友嗎
  • copyright 2024編程學習大全網