寵物蛋糕做法教程 java定義一個動物類,用構(gòu)造方法實現(xiàn)動物的實例化?
java定義一個動物類,用構(gòu)造方法實現(xiàn)動物的實例化?公共類動物{int height//height int weight//weight int age//age string sex//gende
java定義一個動物類,用構(gòu)造方法實現(xiàn)動物的實例化?
公共類動物{int height//height int weight//weight int age//age string sex//gender公共動物(int height,int weight,int age,字符串性){//4參數(shù)構(gòu)造法這個。身高=高度這個重量=重量此年齡=年齡這個。性=sex}public static void main(String[]args){Animal Animal=new Animal(100,60,2,“male”)/*動物有height,weight,age和sex的屬性值*/}