package com.itheima02;
public class Student {
private String name;
private int age;
//构造方法
public Student(){
System.out.println("无参构造方法");
}
public void show(){
System.out.println(name+","+age);
}
}
代码2
package com.itheima02;
public class StudentDemo {
public static void main(String[] args) {
Student s1=new Student();
s1.show();
}
}
执行结果
无参构造方法
null,0
Process finished with exit code 0
标签:JAVA,构造方法,show,itheima02,System,Student,public
From: https://www.cnblogs.com/cy-xt/p/16886182.html