public class Method01{
public static void main(String[] args){
Person p01 = new Person();
p01.speak();
System.out.println("cal01:" + p01.cal01() );
System.out.println("cal02:" + p01.cal02(200) );
}
}
class Person{
String name;
int age;
public void speak(){
System.out.println(" I am a good guy.");
}
public int cal01(){
int sum = 0;
for(int i=1;i<=1000;i++){
sum += i;
}
return sum;
}
public int cal02(int num){
int sum = 0;
for(int i=1;i<=num;i++){
sum += i;
}
return sum;
}
public int getSum(int num01, int num02){
int res = num01 + num02;
return res;
}
}