1. 程式人生 > 其它 >NX二次開發-UF_DRF_ask_dim_info獲得圖紙尺寸屬於哪個檢視和圖紙頁

NX二次開發-UF_DRF_ask_dim_info獲得圖紙尺寸屬於哪個檢視和圖紙頁

static 修飾成員變數:

 1 package cn.itcast.day08.demo03;
 2 
 3 public class Student {
 4 
 5     private int id; //學號
 6     private String name;
 7     private int age;
 8     static String room; //所在教室
 9     private static int idCounter = 0; //學號計數器,每當new了一個新物件的時候,計數器++
10 
11     public Student() {
12         this
.id = ++idCounter; 13 } 14 15 public Student(String name, int age) { 16 this.name = name; 17 this.age = age; 18 this.id = ++idCounter; 19 } 20 21 public String getName() { 22 return name; 23 } 24 25 public void setName(String name) { 26 this
.name = name; 27 } 28 29 public int getAge() { 30 return age; 31 } 32 33 public void setAge(int age) { 34 this.age = age; 35 } 36 37 public int getId() { 38 return id; 39 } 40 41 public void setId(int id) { 42 this.id = id; 43 } 44
}
View Code
 1 /*
 2 如果一個成員變數使用了 static 關鍵字,那麼這個變數不再屬於物件自己,而是屬於所在的類。 多個物件共享同一份資料
 3  */
 4 
 5 public class Demo01StaticField {
 6 
 7     public static void main(String[] args) {
 8         Student one = new Student("郭靖", 19);
 9         one.room = "101Room";
10         System.out.println("name: " + one.getName()
11                 + ",age: " + one.getAge() + ",room: " + one.room + ",id: " + one.getId());
12 
13         Student two = new Student("黃蓉", 16);
14         System.out.println("name: " + two.getName()
15                 + ".age: " + two.getAge() + ",room: " + two.room + ",id: " + two.getId());
16 
17     }
18 }