





Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Attendance Manager Attendance Manager Android Application Project | Android Project
Typology: Assignments
1 / 9
This page cannot be seen from the preview
Don't miss anything!
JAVA Programming Language Homework III - Array, Exception Student ID: Name:
What is the result of attempting to compile the program? A. Prints: Exceptions!!! B. Prints Nothing C. Compiler Error D. Runtime Error E. None of the above
Answer: C
題目中雖然撰寫了 catch 區塊,但並未給予例外類別名稱與建立例外實例,如: catch(ArithmetException e),所以編譯時即會發生錯誤的情形。
What is the result of attempting to compile the program? A. Prints: ABC B. Prints: ABD C. Prints: BCE D. Prints: BCDE E. Compiler Error
Answer: C
c[1] = "B", c[2] = "C", c[3] = 超出陣列索引
What is the result? A. 10987654321 B. 10987612345 C. 12345612345 D. Compiler error E. Runtime exception
Answer: E
呼叫 arraycopy()時,來源陣列必須比目的陣列元素個數來的少,反則會發生超 出陣列索引的情形。
What is the result? A. Prints: 0,0,0,null B. Prints: 0,0,0.0,null C. Prints: 0,0,0, D. Prints: null,null,null,null
E. The code runs with no output.
Answer: B
此題四個資料型態各宣告了 1 維陣列,並配置 2 個陣列元素空間,並且沒有給予 初始值,故此題目的在於測驗各資料型態的預設初始值情形。
What is the result? A. compile-time errors occur at line 3 B. compile-time errors occur at line 4 C. compile-time errors occur at line 5 D. compile-time errors occur at line 6 E. None of the above
Answer: B
若要指定元素個數不可在[]裡寫數值,而是以 new 的方式配置: int[] var2 = new int[5];
What is the result? A. 0,0,1,1,0, B. 0,1,0,1,1, C. 0,0,1,1,0, D. 0,1,1,1,1, E. 1,1,0,1,0,
Answer: A
Compile-time errors occur at which lines? A. 1 B. 2 C. 6 D. 7 E. None of the above
Answer: C
由於所丟出的 Exception 類別比原來方法所丟出的 RuntimeException 的涵蓋範 圍還大,所以在 A 類別裡覆寫 myMethod( )是不合法的作法。