一、Native2Ascii和DOM4j,其中的“2”表示“to”的簡寫,“4”表示“for”的簡寫,這是程序員圈子流行的一種對“to”和“for”進行簡寫的習慣! 二、面向對象的分析與設計 關鍵點:誰擁有數據,誰就有對外提供操作這些數據的方法
人在黑板上畫圓person,blackboard,circledraw(){x,y-->radius}//球從繩子的一端移動到另一端class Rope { PRivate Point start; private Point end; public Rope(Point start,Point end) { this.start=start; this.end=end; } public Point nextPoint(Point currentPoint) { /*通過兩點一線的數學公式可以計算出當前的下一個點,這個細節不屬于設計階段要考慮的問題。 如果當前點時終止點,則返回null,如果當前點不是線上的點,則拋出異常。*/ }}class Ball{ private Rope rope; private Point currentPoint; public Ball(Rope rope,startPoint) { this.ropte=rope; this.currentPoint=startPoint; } public void move() { currentPoint =rope.nextPoint(currentPoint); System.out.print("小球移動到了"+currentPoint); }}兩塊石頭磨成一把石刀,石刀可以砍樹,砍成木材,木材做出椅子 Stone、StoneKnife、tree、material、chair構造對象 StoneKnife=KnifeFactory.createKnife(stone) material=StoneKnife.cut(tree) chair=ChairFactory.makeChair(material)
新聞熱點
疑難解答