?? unit.java
字號:
package com.j2medev.chapter4;
//Unit作為單位使用
public class Unit {
private String[] units = new String[4];
public static final int TEMPERATRUE = 0;
public static final int DISTANCE = 1;
public static final int PRESSURE = 2;
public static final int SPEED = 3;
public Unit() {
}
public String get(int field){
if(field < 0 || field > 3)
throw new IllegalArgumentException("The unit field is not defined");
return units[field];
}
public void set(int index,String value){
units[index] = value;
}
//這里調試用
public String toString(){
return "temperature : "+units[0]+"\n"
+"distance : "+units[1]+"\n"
+"pressure : "+units[2]+"\n"
+"speed : "+units[3]+"\n";
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -