分為編譯時的錯誤與執行時的錯誤
處理異常
try和catch
trycatch(exception e)
多個錯誤可以用多個catch
無論是否出現異常都會被執行
[修飾符] void fun(引數) throws exception,....
throw new exception() 丟擲異常
throws exception,….. 方法上定義
異常提示資訊
堆疊資訊:一層呼叫方法(錯誤直接方法)
二層呼叫方法
。。。。。。
自下而上是異常出現的**所在方法的呼叫順序的先後
在進行大資料的字串拼接時使用 stringbufferpublic
class stringtest
}
public
class stringbuffertest
system.out.println(x.length());
}}
結果public
class datetest {
public
static
void
main(string args) {
date d = new date();
system.out.println((d.getyear()+1900)+"年"+(d.getmonth()+1)+"月"+d.getdate()+"日 "+d.gethours()+":"+d.getminutes()+":"+d.getseconds());
******dateformat sdf = new ******dateformat("yyyy年mm月dd日 hh:mm:ss.sss");
******dateformat sdf2 = new ******dateformat("yyyy年mm月dd日");
system.out.println(sdf.format(d));
system.out.println(sdf2.format(d));
2023年8月30日 20:33
:162023年08月30日
2023年08月30日 20:33
:16.335
8 30 程序管理
1 作業系統基礎 呼叫 kernel通過給應用程式提供system call的方式來提供硬體資源 注意 應用程式也包括庫檔案 庫檔案是執行在ring0上的一段程式 不對客戶直接提 用 2 操作執行原理 乙個程序和多個程序 乙個程序 首先把進硬碟中的程式 載入到記憶體 複製 再將這段程式放到cpu上運...
每日學習總結
1.peek和poll的不同用法 這兩個都是將集合元素取出,但不同的是 poll 在取得元素內容的同時移除該元素,若queue是空則會傳null peek 取得元素內同但不移除該元素,若queue是空則會傳null 2.關於remove的實際test listst new arraylist st....
2016 9 6 每日總結
關於linux學習,本科os基本水過從頭學linux命令 基本操作 man page 操作說明 man 指令內容 例如 man ls sync 將資料同步寫入硬碟的命令 shutdown 正常的關機命令 shutdown h now 立即關機的意思 halt 與shutdown存在區別,shutdo...