Java基础进阶案例教程(课件)例3-13.docxVIP

  • 2
  • 0
  • 约1.46千字
  • 约 3页
  • 2018-12-28 发布于江西
  • 举报

Java基础进阶案例教程(课件)例3-13.docx

class Staff { //声明类 private static String country; //静态成员变量 //私有成员变量id和name private int id; private String name; static void setCountryAndPrint(String c) //静态成员方法 { //name=testName; //把注释去掉,则程序会出错 country=c; System.out.println(staffs country is : +country); } Staff() //无参数构造方法 {} Staff(int i,String n) //两个参数的构造方法,对id和name初始化 { id=i; name=n; } //成员变量id、name和country的读/写访问器 public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String nam

文档评论(0)

1亿VIP精品文档

相关文档