java里最基础的speak
java里最基础的speakclassXiyoujirenwu{floatheight,weight;Stringhead,ear,hand,foot,mouth;voi...
java里最基础的speakclass Xiyoujirenwu
{float height,weight;
String head,ear,hand,foot,mouth;
void speak(String s)
{
head="歪着头";
System.out.println(s);
}
}
class wocao
{public static void main(String args[])
{
Xiyoujirenwu zhubajie,sunwukong;
zhubajie=new Xiyoujirenwu();
sunwukong=new Xiyoujirenwu();
zhubajie.height=1.8f;
zhubajie.weight=160f; zhubajie.hand="两只黑手";
zhubajie.foot="两只大脚"; zhubajie.head="大头";
zhubajie.ear="一双大耳朵"; zhubajie.mouth="一只大嘴";
sunwukong.height=1.62f;
sunwukong.weight=1000f; sunwukong.hand="白嫩小手";
sunwukong.foot="两只锈脚"; sunwukong.head="秀发飘飘";
sunwukong.ear="一对小耳"; sunwukong.mouth="樱桃小嘴";
System.out.println("zhubajie的身高:"+zhubajie.height);
System.out.println("zhubajie的头:"+zhubajie.head);
System.out.println("sunwukong的重量:"+sunwukong.weight);
System.out.println("sunwukong的头:"+sunwukong.head);
zhubajie.speak("俺老猪我想娶媳妇");
System.out.println("zhubajie现在的头:"+zhubajie.head);
zhubajie.speak("老孙我重1000斤,我想骗八戒背我");
System.out.println("sunwukong现在的头:"+sunwukong.head);
}
为什么是speak后的 俺老猪我想娶媳妇 能输出??? 展开
{float height,weight;
String head,ear,hand,foot,mouth;
void speak(String s)
{
head="歪着头";
System.out.println(s);
}
}
class wocao
{public static void main(String args[])
{
Xiyoujirenwu zhubajie,sunwukong;
zhubajie=new Xiyoujirenwu();
sunwukong=new Xiyoujirenwu();
zhubajie.height=1.8f;
zhubajie.weight=160f; zhubajie.hand="两只黑手";
zhubajie.foot="两只大脚"; zhubajie.head="大头";
zhubajie.ear="一双大耳朵"; zhubajie.mouth="一只大嘴";
sunwukong.height=1.62f;
sunwukong.weight=1000f; sunwukong.hand="白嫩小手";
sunwukong.foot="两只锈脚"; sunwukong.head="秀发飘飘";
sunwukong.ear="一对小耳"; sunwukong.mouth="樱桃小嘴";
System.out.println("zhubajie的身高:"+zhubajie.height);
System.out.println("zhubajie的头:"+zhubajie.head);
System.out.println("sunwukong的重量:"+sunwukong.weight);
System.out.println("sunwukong的头:"+sunwukong.head);
zhubajie.speak("俺老猪我想娶媳妇");
System.out.println("zhubajie现在的头:"+zhubajie.head);
zhubajie.speak("老孙我重1000斤,我想骗八戒背我");
System.out.println("sunwukong现在的头:"+sunwukong.head);
}
为什么是speak后的 俺老猪我想娶媳妇 能输出??? 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询