定義一個類Point,表明一個點,public屬性有x和y,方法有顯示點座標 show(),構造函數有兩個參數分別給x,y賦值,在main方法中構造兩個對象,再建立一方法(getMiddle)...

這個題讓我更加明白了類建立對象的實質html 代碼中用到:1.對象做形參;2.對象做返回值函數 如下用代碼具體分析:post 1 class Point1{ 2 public double x; 3 public double y; 4 Point1(){} 5 6 public Point1(double x,double y){ 7 this.x=x; 8 this.y=y;
相關文章
相關標籤/搜索
本站公眾號
   歡迎關注本站公眾號,獲取更多信息
相關文章