?? forecast.java
字號:
package com.j2medev.chapter4;
//Forecast代表了天氣預報信息
public class Forecast {
public static final int DAY = 0;
public static final int DATE = 1;
public static final int LOW = 2;
public static final int HIGH = 3;
public static final int TEXT = 4;
public static final int CODE = 5;
private Unit unit = null;
private String[] forcast = new String[6];
public Forecast() {
}
public void setUnit(Unit u){
this.unit = u;
}
public String get(int field){
if(field < 0 || field > 6)
throw new IllegalArgumentException("the att is not defined");
return forcast[field];
}
public void set(int index,String value){
forcast[index]=value;
}
public String toString(){
return "day : "+forcast[0]+"\n"
+"date : "+forcast[1]+"\n"
+"low : "+forcast[2]+unit.get(Unit.TEMPERATRUE)+"\n"
+"high : "+forcast[3]+unit.get(Unit.TEMPERATRUE)+"\n"
+"text : "+forcast[4]+"\n";
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -