package com.atguigu.exercise;
public class TriAngleTest {
public static void main(String[] args) {
TriAngle t1 = new TriAngle();
t1.steBase(2.1);
t1.steHeight(5.0);
System.out.println(t1.getBase()+" , "+ t1.steHeight());
}
}
package com.atguigu.exercise;
public class TriAngle {
private double base;//底边长
private double height;//高
//构造器
public TriAngle(){
}
public TriAngle(double b,double h){
base = b;
height = h;
}
//方法
public void steBase(double b){
base = b;
}
public double getBase(){
return base;
}
public void steHeight(double h){
height = h;
}
public double steHeight(){
return height;
}
}