代码:
public class Tain {
private double yibian;
private double erbian;
private double sanbian;
public Tain(double yibian,double erbian,double sanbian)
{
this.yibian=yibian;
this.erbian=erbian;
this.sanbian=sanbian;
}
public double Sjxzc(){
return yibian+erbian+sanbian;
}
public double Sjxmj(){
double p=Sjxzc()/2;
double areaa=Math.sqrt(p*(p-yibian)*(p-erbian)*(p-sanbian));
return areaa;
}
public static void main(String[] args){
Tain SJXSJX=new Tain(3,4,5);
double SSS=SJXSJX.Sjxzc();
System.out.println(SSS);
double ZZZC=SJXSJX.Sjxmj();
System.out.println(ZZZC);
}
}
收获以及感想:
1.总的来说有进步,但是对于随心所欲写java代码还不够,得多敲代码,有空常敲。
2.java得好好学习,用处大;
3.不要想着一天就把它全部学会,循序渐进才是进步最快的方法。