class student { private String name="zhang"; private int num=12; @Override public String toString() { return "名字为:" + name +","+ "学号为:" + num; } } public class Main { public static void main(String[] args) { student stu = new student(); System.out.println(stu); } }