package day_13;
class Count02{
public int getsum(){
int sum=0;//用于收集1-100的值
for (int i=1;i<=100;i++){
sum+=i;
}
return sum;
}
}
public class Method_Exer03 {
public static void main(String[] args) {
Count02 c=new Count02();
//调用函数 计算和
int sum=c.getsum();
System.out.println("1-100的和是:"+sum);
}
}