日志 > 软件编程
SCJP考试题-4
QUESTION NO 135Given:
1. public class Foo implements Runnable ( 2. public void run (Thread t) { 3. system.out.printIn(“Running.”); 4. } 5. public static void main (String[] args) { 6. new thread (new Foo()).start(); 7. ) 8. ) What is the result? A. An exception is thrown. B. The program exists without printing anything. C. An error at line 1 causes compilation to fail. D. An error at line 6 causes the compilation to fail. E. “Running” is printed and the program exits. Answer: C QUESTION NO 136 Which constructs a DataOutputStream? A. New dataInputStream(“in.txt”); B. New dataInputStream(new file(“in.txt”)); C. New dataInputStream(new writer(“in.txt”)); D. New dataInputStream(new FileWriter(“in.txt”)); E. New dataInputStream(new InputStream(“in.txt”)); F. New dataInputStream(new FileInputStream(“in.txt”)); Answer: F QUESTION NO 137 Which can be used to decode charS for output? A. Java.io.InputStream. B. Java.io.EncodedReader. C. Java.io.InputStreamReader. D. Java.io.InputStreamWriter. E. Java.io.BufferedInputStream. Answer: C QUESTION NO 138 Given: 1. public class Test { 2. public static void main (String [] args) { 3. string foo = “blue”; 4. string bar = foo; 5. foo = “green”; 6. System.out.printIn(bar); 7. } 8. } What is the result? A. An exception is thrown. B. The code will not compile. C. The program prints “null” D. The program prints “blue” E. The program prints “green” Answer: D QUESTION NO 139 Which code determines the int value foo closest to a double value bar? A. Int foo = (int) Math.max(bar); B. Int foo = (int) Math.min(bar); C. Int foo = (int) Math.abs(bar); D. Int foo = (int) Math.ceil(bar); E. Int foo = (int) Math.floor(bar); F. Int foo = (int) Math.round(bar); Answer: F QUESTION NO 140 Which two demonstrate encapsulation of data? (Choose Two) A. Member data have no access modifiers. B. Member data can be modified directly. C. The access modifier for methods is protected. D. The access modifier to member data is private. E. Methods provide for access and modification of data. Answer: D, E QUESTION NO 141 Exhibit: 1. class A { 2. public String toString () { 3. return “4”; 4. } 5. } 6. class B extends A { 7. 8. public String toString () { 8. return super.toString() + “3”; 9. } 10. } 11. public class Test { 12. public static void main(String[]args) { 13. System.out.printIn(new B()); 14. } 15. } What is the result? A. Compilation succeeds and 4 is printed. B. Compilation succeeds and 43 is printed. C. An error on line 9 causes compilation to fail. D. An error on line 14 causes compilation to fail. E. Compilation succeeds but an exception is thrown at line 9. Answer: B QUESTION NO 142 Which two statements are true? (Choose Two) A. An anonymous inner class can be declared inside of a method B. An anonymous inner class constructor can take arguments in some situation. C. An anonymous inner class that is a direct subclass that is a direct subclass of Object can implement multiple interfaces. D. Even if a class Super does not implement any interfaces, it is still possible to define an anonymous inner class that is an immediate subclass of Super that implements a single interface. E. Event if a class Super does not implement any interfaces, it is still possible to define an anonymous inner class that is an immediate subclass of Super that implements multiple interfaces. Answer: A, B QUESTION NO 143 Given: 1. public class MethodOver { 2. private int x, y; 3. private float z; 4. public void setVar(int a, int b, float c){ 5. x = a; 6. y = b; 7. z = c; 8. } 9. } Which two overload the setVar method? (Choose Two) A. void setVar (int a, int b, float c){ x = a; y = b; z = c; } B. public void setVar(int a, float c, int b) { setVar(a, b, c); } C. public void setVar(int a, float c, int b) { this(a, b, c); } D. public void setVar(int a, float b){ x = a; z = b; } E. public void setVar(int ax, int by, float cz) { x = ax; y = by; z = cz; } Answer: B, D QUESTION NO 144 Which statements about static inner classes are true? (Choose Two) A. A static inner class requires a static initializer. B. A static inner class requires an instance of the enclosing class. C. A static inner class has no reference to an instance of the enclosing class. D. A static inner class has access to the non-static members of the outer class. E. Static members of a static inner class can be referenced using the class name of the static inner class. Answer: C, E QUESTION NO 145 Given: 1. public class X { 2. public object m () { 3. object o = new float (3.14F); 4. object [] oa = new object [1]; 5. oa[0]= o; 6. o = null; 7. oa[0] = null; 9. return o; 9. } 10. } When is the float object created in line 3, eligible for garbage collection? A. Just after line 5. B. Just after line 6. C. Just after line 7. D. Just after line 8(that is, as the method returns). Answer: C QUESTION NO 146 Which two interfaces provide the capability to store objects using a key-value pair? (Choose Two) A. Java.util.Map. B. Java.util.Set. C. Java.util.List. D. Java.util.StoredSet. E. Java.util.StoredMap. F. Java.util.Collection. Answer: A, E QUESTION NO 147 Which interface does java.util.Hashable implement? A. Java.util.Map. B. Java.util.List. C. Java.util.Hashable. D. Java.util.Collection. Answer: A |
想第一个看到日志抢沙发?评论列表
/x02").replace(//[//quote/]/g,"/x01"); for(var i=0;i<2;i++) s=s.replace(//x03([^/x03/x01/x02]*?)/x02([^/x03/x01/x02]*?)/x01/g, function(a,b,c){ return '
'+b+'引用内容:'; }); return s.replace(/[/x03/x02/x01]/g,""); } var bLoaded = false; function checkMsgReply(obj) { if(!bLoaded) top.includeJS('/qzone/blog/script/common.js', function(){bLoaded=true;checkMsgReply(obj)}, document); else checkReply(obj); if(obj.checked){ MAX_COMMENT_LEN = 500; } else { MAX_COMMENT_LEN = 4500; } _fontCount = MAX_COMMENT_LEN; //字数限制 if(!window.sendCommentEditor) return; if(sendCommentEditor.editorArea.editMode == 1) toCountFont(sendCommentEditor.id, "html"); else toCountFont(sendCommentEditor.id, "text"); } function showMsgLeftCnt() { if(!bLoaded) top.includeJS('/qzone/blog/script/common.js', function(){bLoaded=true;showMsgLeftCnt();}, document); else showLeftSMS(); } function selectBlogPaper() { if(checkLogin() <= 10000) { top.showLoginBox("mall"); return; } if(!!top.g_JData["blogContent"]) { if(parent.g_iLoginUin == parent.g_iUin) { location.href="/qzone/newblog/blogeditor.html?paperid=" + parent.g_JData["blogContent"].data.lp_id + "&paperstyle=" + parent.g_JData["blogContent"].data.lp_style + "&paperdialog=1"; } else { parent.location.href="http://user.qzone.qq.com/" + parent.g_iLoginUin + "/addNewBlog?paperid=" + parent.g_JData["blogContent"].data.lp_id + "&paperstyle=" + parent.g_JData["blogContent"].data.lp_style; } } else { top.showMsgBox("抱歉,暂时无法获取该信纸信息!", 1, 2000); } } /** * 批量删除中选择全选 */ function selectAllComments(bChecked) { var oList = document.getElementsByName("commentCheckBox"); if(oList.length==0) return; for(var i=0; i 0){ dalert(null, parent.g_XDoc["delBatchReply"].xml, 2000); delete parent.g_XDoc["delBatchReply"]; return; } dalert(null, parent.g_XDoc["delBatchReply"].xml, 2000, 2); contentProperty.totalCommentNumber -= nDeleteCnt; //清理cache with(contentProperty){ delete parent.g_XDoc["blogRoot"].contentHSList[currentBlogid]; pageList = {}; pageIndexMap = []; currentCommentPage = lastCommentPage = (!contentProperty.nowaPage)?0:nowaPage[3]; parent.g_XDoc["blogRoot"].replyNumUpdateHSmap[currentBlogid] = totalCommentNumber; parent.isRefreshTop = true; if(currentCommentPage == 0) { setTimeout(contentInit, 1000); } else{ var tp = Math.ceil(totalCommentNumber/PAGE_COMMENT_NUM); var num = totalCommentNumber%PAGE_COMMENT_NUM; if(num==0 || currentCommentPage10000 && top.g_iLoginUin!=top.g_iUin) { $("msgboardSelfReply").style.display = ""; $("blogSelPaper").title = "我也要使用此信纸写日志"; } setTimeout(contentInit,50); //]]> </script>'+c+'
了解各界捐助动态及捐赠渠道,请点击此处。
共0篇评论,第1页/共0页
批量删除 取消批量删除
共0篇评论,第1页/共0页