package com.lxk.damo;
public class Student {
private int id;
private String name;
public Student(int id,String name){
this.id = id;
this.name = name;
}
@Override
public String toString() {
return "[" + this.id + "" +this.name + "]";
}
}
package com.lxk.jsu;
import com.lxk.damo.Student;
public class Text1 {
public static void main(String[] args){
Student a = new Student(1001, "张三");
System.out.println(a);
}
}
跨包调用:输出自己的名字和学号
最新推荐文章于 2024-07-14 22:18:32 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)