//方法重载
public class Demo12 {
public static void main(String[] args) {
Demo12 d12=new Demo12();
d12.s1();
d12.s1(20,30);
d12.s1("zhangsan",10086,12);
Demo12 d1=new Demo12(20,30);
Demo12 d2=new Demo12(10,20,30,40);
}
public void s1(){
System.out.println("无参数的s1普通方法");
}
void s1(int age,int id){
System.out.println("编号:"+id+"年龄"+age);
}
void s1(String name,int age, int id){
System.out.println(name+age+id);
}
public int s1(int a,int b,int c){
System.out.println(a+b+c);
return 16+20+30;
}
Demo12(){
System.out.println("这是无参数的构造方法");
}
Demo12(int age,int id){
System.out.println("这是有参数的构造方法"+age+"id:"+id);
}
Demo12(int a,int b,int c,int d){
System.out.println(a+b+c+d);
}
}