Java 内涵数的调用
作者:互联网
class person{
String color;
public person(String color){
this.color=color;
}
class heart{
int suy;
int soy;
int zp;
public heart(int suy,int soy,int zp){
this.soy=soy;
this.suy=suy;
this.zp=zp;
}
public void xt(){
System.out.println(color+"的心在拼命的跳动!");
}
}
public void HEART(){
int a=1+(int)(Math.random()*523);
int b=1+(int)(Math.random()*323);
int c=1+(int)(Math.random()*241);
heart H=new heart(a,b,c);
System.out.println("心脏的帧频为:"+c);
System.out.println("舒张压为:"+b);
System.out.println("收缩压为:"+a);
H.xt();
}
}
public class Demo3 {
public static void main(String[] args) {
int j=1+(int)(Math.random()*3);
switch(j){
case 1:
person p1=new person("黄种人");p1.HEART();break;
case 2:
person p2=new person("黑种人");p2.HEART();break;
case 3:
person p3=new person("白种人");p3.HEART();break;
}
}
}
标签:heart,调用,Java,int,System,person,内涵,public,color 来源: https://www.cnblogs.com/3w1z3/p/10951651.html