Java类重复怎么解决
publicclasspatient{privateStringName;privatecharSex;privateintAge;privatefloatWeight;...
public class patient {
private String Name;
private char Sex;
private int Age;
private float Weight;
private boolean Allergies;
public void setName(String a)
{Name=a;}
public void setSex(char b)
{Sex=b;}
public void setAge(int c)
{Age=c;}
public void setWeight(float d)
{Weight=d;}
public void setAllergies(boolean e)
{Allergies=e;}
public String getName(){return Name;}
public char getSex(){return Sex;}
public int getAge(){return Age;}
public float getWeight(){return Weight;}
public boolean getAllegies(){return Allergies;}
}
public class patient
{
public static void main(String args[])
{
patient aprill=new patient();
aprill.setName("ZhangLi");
aprill.setSex('f');
aprill.setAge(33);
aprill.setWeight(154.32f);
aprill.setAllergies(true);
System.out.println("Name: "+aprill.getName());
System.out.println("Sex: "+aprill.getSex());
System.out.println("Age: "+aprill.getAge());
System.out.println("Weight: "+aprill.getWeight());
System.out.println("Allergies: "+aprill.getAllergies());
}
} 展开
private String Name;
private char Sex;
private int Age;
private float Weight;
private boolean Allergies;
public void setName(String a)
{Name=a;}
public void setSex(char b)
{Sex=b;}
public void setAge(int c)
{Age=c;}
public void setWeight(float d)
{Weight=d;}
public void setAllergies(boolean e)
{Allergies=e;}
public String getName(){return Name;}
public char getSex(){return Sex;}
public int getAge(){return Age;}
public float getWeight(){return Weight;}
public boolean getAllegies(){return Allergies;}
}
public class patient
{
public static void main(String args[])
{
patient aprill=new patient();
aprill.setName("ZhangLi");
aprill.setSex('f');
aprill.setAge(33);
aprill.setWeight(154.32f);
aprill.setAllergies(true);
System.out.println("Name: "+aprill.getName());
System.out.println("Sex: "+aprill.getSex());
System.out.println("Age: "+aprill.getAge());
System.out.println("Weight: "+aprill.getWeight());
System.out.println("Allergies: "+aprill.getAllergies());
}
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询