国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

java中this關鍵字用法

2019-11-17 04:04:29
字體:
來源:轉載
供稿:網友
view plaincopy to clipboardPRint?
/**  
* this關鍵字用法  
*/  
public class Flower {   
       
    int petalCount = 0;   
    String s = "initial value";   
       
    Flower(int petals){   
        petalCount = petals;   
        System.out.println("Constructor with one int arg");   
    }   
       
    Flower(String ss){         
        System.out.println("Constructor with one string arg");   
        s = ss;   
    }   
       
    Flower(String ss, int petals){   
        this(petals);   
        this.s = ss;   
        System.out.println("Constructor with string and int args");   
    }   
       
    Flower(){   
        this("hi",47);   
        System.out.println("Default Constructor with no args");   
    }   
       
    void printPetalCount(){   
        System.out.println("petalCount = "+petalCount+"; s = "+s);   
    }   
    /**  
     * @param args  
     */  
    public static void main(String[] args) {   
        // TODO Auto-generated method stub   
        Flower x = new Flower();   
        x.printPetalCount();   
    }   
}   
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 长沙市| 小金县| 襄垣县| 永修县| 汝南县| 祁连县| 泌阳县| 周口市| 台安县| 政和县| 亚东县| 拉萨市| 雷山县| 广安市| 临沂市| 洪洞县| 赤峰市| 离岛区| 亳州市| 莫力| 犍为县| 宁都县| 田东县| 晋中市| 龙山县| 五原县| 界首市| 宜宾市| 台东市| 县级市| 文登市| 韩城市| 杭州市| 江山市| 辽宁省| 当涂县| 大埔县| 古田县| 合阳县| 五台县| 庆云县|