Java 类的定义与调用
package cn.itbaizhan; public class SxtStu { int id; String name; int age; void learn(){ System.out.println(id+"号"+name+"在学习年龄"+age); } //构造方法 SxtStu(){ } public static void main(String[] args) { SxtStu s1 = new SxtStu(); s1.id = 001; s1.name = "李四"; s1.age = 18; s1.learn(); SxtStu s2 = new SxtStu(); s2.learn(); } }