請寫出 5 種常見到的runtime exception
答:
NullPointerException:當操作一個空引用時會出現此錯誤。 NumberFormatException:資料格式轉換出現問題時出現此異常。 ClassCastException:強制型別轉換型別不匹配時出現此異常。 ArrayIndexOutOfBoundsException:陣列下標越界,當使用一個不存在的陣列下標時出現此異常。 ArithmeticException:數學執行錯誤時出現此異常
相關推薦
請寫出 5 種常見到的runtime exception
答: NullPointerException:當操作一個空引用時會出現此錯誤。 NumberFormatException:資料格式轉換出現問題時出現此異常。 ClassCastException:強制型別轉換型別不匹配時出現此異常。 ArrayIndexOutOfBoundsExcept
面試題4——請寫出5種常見到的runtime exception
常見RuntimeException: ArrayStoreException:試圖將錯誤型別的物件儲存到一個物件陣列時丟擲的異常 ClassCastException:試圖將物件強制轉換為不是例項的子類時,丟擲該異常 IllegalArgumentException:
請寫出5種常見到的runtime exception
RuntimeException是java中所有執行時異常的父類,實際執行時出現的都是它的子類。1, ClassCastException型別強制轉換異常Object x = new Integer(0); System.out.println((String)x);
面試官:來,年輕人!請手擼5種常見限流演算法!
1. **瞬時流量過高,服務被壓垮?** 2. **惡意使用者高頻光顧,導致伺服器宕機?** 3. **訊息消費過快,導致資料庫壓力過大,效能下降甚至崩潰?** ...... 在高併發系統中,出於系統保護角度考慮,通常會對流量進行限流;不但在工作中要頻繁使用,而且也是面試中的高頻考點。 今天我們將圖
對陣列 [3, 1, 2, 4, 2, 4, 5, 3, 7] 進行去重, 寫出至少兩種方法 (請寫出一段Python程式碼實現刪除一個list裡面的重複元素)
1. 對陣列 [3, 1, 2, 4, 2, 4, 5, 3, 7] 進行去重, 寫出至少兩種方法 (請寫出一段Python程式碼實現刪除一個list裡面的重複元素)In [1]:def unique1
請寫出你最常見到的5個runtime&nbs…
所謂系統異常,就是…..,它們都是RuntimeException的子類,在jdk doc中查RuntimeException類,就可以看到其所有的子類列表,也就是看到了所有的系統異常。我比較有印象的系統異常有:NullPointerException、ArrayIndexOutOfBoundsExc
java中5種常見的異常(Exception)
1. Java.lang.NullPointerException 這個異常大家肯定都經常碰到,異常的解釋是"程式遇上了空指標",簡單地說就是呼叫了未經初始化的物件或者是不存在的物件,這個錯誤經常出現在建立圖片,呼叫陣列這些操作中,比如圖片未經初始化,或者圖片建立時
請寫出在ASP.NET中常用的幾種頁面間傳值的方法,並說出它們的特點。
QueryString 傳遞一個或多個安全性要求不高或是結構簡單的數值。但是對於傳遞陣列或物件的話,就不能用這個方法了 session(viewstate) 簡單,但易丟失 作用於使用者個人,過量的儲存會導致伺服器記憶體資源的耗盡。 application 物件的作用範
寫出一種排序算法(要寫出代碼),並說出優化它的方法。
TE 插入排序 我們 part while IT 如果 urn class 1 <?php 2 //快速排序 3 function partition(&$arr, $low, $high) 4 { 5 $pivotkey = $arr[$
5種常見的單例模式
序列化 暫時 判斷 避免 static urn 返回 空間 data- 1.懶漢式(使用時構建對象) 1.1 版本1:直接私有化構造函數。 缺點:非線程安全,當多個線程同時運行到if (instance==null)時,會創建多個對象。 1 publ
【轉】請說出三種減少頁面載入時間的方法。
1.優化圖片 2.影象格式的選擇(GIF:提供的顏色較少,可用在一些對顏色要求不高的地方) 3.優化CSS(壓縮合並css,如margin-top,margin-left...) 4.網址後加斜槓(如ww
【轉】請說出三種減少頁面加載時間的方法。
www com 無法 如果 壓縮合並 class 是什麽 .com 高度 1.優化圖片 2.圖像格式的選擇(GIF:提供的顏色較少,可用在一些對顏色要求不高的地方) 3.優化CSS(壓縮合並css,如margin-top,margin-left...) 4.網
請寫出一段Python程式碼實現刪除一個list裡面的重複元素?
方法1:使用set函式 s=set(list),然後再list(s) 方法2:append 1 def delList(L): 2 L1 = [] 3 for i in L: 4
單例設計模式總結-5種常見寫法+防止發射反序列化
單例模式是設計模式中最常見的,也是最簡單的一種,所謂單例,是需要在任何時候只存在一個物件例項,故顯然需要私有化構造器,構造器私有了,要想獲得這個例項,故必須在類內部建立物件例項,同時必須提供靜態方法來獲取,靜態方法只能操作靜態屬性,故內部物件例項需要被static修飾,由於單例,可用final修飾;
Hive面試題:請寫出你在工作中自定義過的udf函式,簡述定義步驟
步驟: 1.extends UDF,實現evaluate() 2.add JAR /home/hadoop/hivejar/udf.jar; 3.create temporary function tolowercase as 'com.ghgj.hive.udf.ToLowerCa
假設高度已知,請寫出三欄佈局,其中左欄、右欄寬度各為300px,中間自適應
解決方案: <!DOCTYPE html> <html lang="en" dir="ltr"> <head> <meta charset="utf-8"> <title>test1<
網路I/O模型--5種常見的網路I/O模型
阻塞與非阻塞 阻塞就是卡在那兒什麼也不做,雙方之間也沒有資訊溝通。 非阻塞就是即使對方不能馬上完成請求,雙方之間也有資訊的溝通。 同步與非同步 同步就是一件事件只由一個過程處理完成,不論阻塞與非阻塞,最後完成這個事情的都是同一個過程 非同步就是一件事由兩個過程完成,前
Rm –rf誤刪除了一個數據檔案,而備份集恰好損壞,請寫出恢復步驟
Oracle使用者下: rm -rf /u01/app/oracle/oradata/vastdb/users01.dbf ps -ef | grep ora_lgwr ps命令將某個程序顯示出來 grep命令是查詢 中間的|是管道命令 是指ps命令與g
C語言連結串列的5種常見操作
C語言連結串列的5種常見操作 單鏈表反轉 連結串列中環的檢測 兩個有序的連結串列合併 刪除連結串列倒數第n個結點 求連結串列的中間結點 Ref typedef struct list{ int i
JavaScript中如何檢測一個變數是一個String型別?請寫出函式實現
1.function a(obj){ return typeof(obj)=="string"; } alert(a(123)); alert(a("abc")); 2.function b(obj){ return obj.construct