版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
2024年计算机考试-Java认证笔试考试历年高频考点试题摘选含答案第1卷一.参考题库(共75题)1.What writes the text “ ” to the end of the file “file.txt”?()A、 OutputStream out= new FileOutputStream (“file.txt”);
Out.writeBytes (“ /n”);B、 OutputStream os= new FileOutputStream (“file.txt”, true);
DataOutputStream out = new DataOutputStream(os); out.writeBytes (“ /n”);C、 OutputStream os= new FileOutputStream (“file.txt”);
DataOutputStream out = new DataOutputStream(os); out.writeBytes (“ /n”);D、 OutputStream os= new OutputStream (“file.txt”, true);
DataOutputStream out = new DataOutputStream(os); out.writeBytes (“ /n”);2.编写一个Java程序,接受用户输入的一个l-12之间的整数(如果输入的数据不满足这个条件,则要求用户重新输入),利用switch语句输出对应月份的天数。3.public class AssertStuff { public static void main(String [] args) { int x= 5; int y= 7; assert (x> y): “stuff”; System.out.println(”passed”); } } And these command line invocations:java AssertStuff java -ea AssertStuff What is the result?()A、 passed stuffB、 stuff passedC、 passed
An AssertionError is thrown with the word “stuff” added to the stack trace.D、 passed
An AssertionError is thrown without the word “stuff” added to the stack trace.E、 passed
An AssertionException is thrown with the word “stuff” added to the stack trace.F、 passed
An AssertionException is thrown without the word “stuff” added to the stack trace.4.What is the result?() A、CatB、DogC、Compilation fails.D、The code runs with no output.E、An exception is thrown at runtime.5.5. String foo = “base”; 6. foo.substring(0,3); 7. foo.concat(“ket”) 8. Type the value of foo at line 8.()6.应用FileInputStream类,编写应用程序,从磁盘上读取一个Java程序,并将源程序代码显示在屏幕上。(被读取的文件路径为:E:///myjava/Hello.java)7.企业发放的奖金根据利润提成。利润(I)低于或等于10万元时,奖金可提10%;利润高于10万元,低于20万元时,低于10万元的部分按10%提成,高于10万元的部分,可可提成7.5%;20万到40万之间时,高于20万元的部分,可提成5%;40万到60万之间时高于40万元的部分,可提成3%;60万到100万之间时,高于60万元的部分,可提成1.5%,高于100万元时,超过100万元的部分按1%提成,从键盘输入当月利润,求应发放奖金总数?8.1. class Alpha { void m1() {} } 2. class Beta extends Alpha { void m2() { } } 3. class Gamma extends Beta { } 4. 5. class GreekTest { 6. public static void main(String [] args) { 7. a Alpha [] a = {new Alpha(), new Beta(), new Gamma() }; 8. for(Alpha a2 : a) { 9. a2.m1(); 10. if (a2 instanceof Beta || a2 instanceof Gamma) 11. //insert code here 12. } 13. } 14. } 哪一行代码插入到第11行,将编译但是会在运行时产生异常?() A、 a2.m2();B、 ((Beta)a2).m2();C、 ((Alpha)a2).m2();D、 ((Gamma)a2).m2();9.int i = 1,j = 10; do{ if (i>j) { continue; } j--; } while (++i A、 i = 6 and j = 5B、 i = 5 and j = 5C、 i = 6 and j = 4D、 i = 5 and j = 6E、 i = 6 and j = 610.Which two CANNOT directly cause a thread to stop executing? () A、 Existing from a synchronized block.B、 Calling the wait method on an object.C、 Calling notify method on an object.D、 Calling read method on an InputStream object.E、 Calling the SetPriority method on a Thread object.11.宴会上一共有1225次握手,设每一位参加宴会的人对其他与会人士都有一样的礼节,那么与会人士有多少人?12.以下关于中断控制语句的描述,错误的是()A、 return用于退出整个子程序B、 continue停止继续执行下面的语句,直接跳回循环起始位置C、 break用于强行退出循环,不执行循环中剩余的语句D、 break语句用于中断当前的程序块,如for循环块,if结构块等的执行E、 在一个函数中,不管有没有返回值,都需要return语句来推出函数13.如何设置表格型布局方式?()A、创建一个表格型布局管理器B、在构造函数中指定表格的行数或列数C、添加组件,组件将按行逐个放到表格中D、创建一个表格型面板E、添加组件,需要指定组件放在表格的哪一行和哪一列14. What is the output? 15.public class Test { public static void replaceJ(string text) { text.replace (‘j‘, ‘l‘); } public static void main(String args) { string text = new String (“java”) replaceJ(text); system.out.printIn(text); } } What is the result?() A、 The program prints “lava”B、 The program prints “java”C、 An error at line 7 causes compilation to fail.D、 Compilation succeeds but the program throws an exception.16.public class Team extends java.util.LinkedList { public void addPlayer(Player p) { add(p); } public void compete(Team opponent) { /* more code here */ } } class Player { /* more code here */ } Which two are true?()A、 This code will compile.B、 This code demonstrates proper design of an is-a relationship.C、 This code demonstrates proper design of a has-a relationship.D、 A Java programmer using the Team class could remove Player objects from a Team object.17.You have created a servlet that generates weather maps. The data for these maps is calculated by aremote host. The IP address of this host is usually stable, but occasionally does have to change as thecorporate network grows and changes. This IP address used to be hard coded, but after the fifth change tothe IP address in two years, you have decided that this value should be declared in the deploymentdescriptor so you do NOT have the recompile the web application every time the IP address changes. Which deployment descriptor snippet accomplishes this goal?()A、B、C、D、18.求一个3*3矩阵对角线元素之和.19.有工人,农民,教师,科学家,服务生,其中,工人,农民,服务生只有基本工资.教师除基本工资外,还有课酬(元/天),科学家除基本工资外,还有年终奖,请你写出相关类,将各种类型的员工的全年工资打印出来20.class java { public static void main(String [] java) { for (int Java = 1; Java 〈 java.length; Java++) System.out.print("java "); } } 和命令行: java java java java java 结果为:() A、javaB、java javaC、java java javaD、编译失败21.结构化程序设计有哪三种基本流程?分别对应Java中的哪些语句?22.流式布局的常用设置参数有哪些?() A、设置组件间的水平间隙和垂直间隙B、设置每行最多放几个组件C、设置行对齐方式D、设置组件最多可以分几列放E、设置面板的最大尺寸和最小尺寸23.What is the result?() A、w-fB、f-p,w-fC、w-f,b-fD、f-p,w-f b-fE、Compilation fails.F、An exception is thrown at runtime.24.A developer wants to make a name attribute available to all servlets associated with a particular user,across multiple requests from that user, from the same browser instance. Which two provide this capabilityfrom within a tag handler?()A、pageContext.setAttribute("name", theValue)B、pageContext.setAttribute("name", getSession())C、pageContext.getRequest().setAttribute("name", theValue)D、pageContext.getSession().setAttribute("name", theValue)E、pageContext.setAttribute("name", theValue,PageContext.PAGE_SCOPE)F、pageContext.setAttribute("name", theValue,PageContext.SESSION_SCOPE)25.Which two directives are applicable only to tag files?()A、TagB、PageC、TaglibD、IncludeE、Variable26.Java语言中表达式“11”+22的结果是哪项?() A、33B、1122C、22D、表达式错误27.已知: 的输出为()A、aB、bC、cD、null28.假如我们想要对象eh来处理TextArea对象t的TextEvent事件,那么我们应如何把eh添加为t的事件处理程序?() A、 t.addTextListener (eh)B、 eh.addTextListener (t)C、 addTextListener (eh,t)D、 addTextListener (t, eh)29. Which EL expression, inserted at line 3 is valid and evaluated to “beanValue”?()A、 ${bean}B、 ${value}C、 ${beanValue}D、 ${com.example.bean}E、 ${requestScope[“com.example.bean”]}F、 ${request.get(“com.example.bean”).toString()}30.现有: 3. import java.util.*; 4. class ForInTest { 5.static List list=new ArrayList(); 6. 7.public static void main (String [] args) { 8.list. add("a"); list. add("b");list. add( "c"); 9. //insert code here 10. System.out.print (o); 11. } 12. } 哪一行插入到第9行将导致输出“abc"?() A、 for (Iterator o : list.iterator(); o.hasNext (); )B、 for (Iterator 0 : list)C、 for (Object o : list.iterator())D、 for (Object o : list)31.某试卷由26个问题组成,答对一题得8分,答错一题扣5分。今有一考生虽然回答了全部26个问题,但所得总分为零,问他错答多少题。32.Given: 8.int index = 1: 9.Boolean [] test = new boolcan [3]; 10.boolcan foo = test [index]; What is the result()? A、 foo has the value of 0.B、 foo has the value of null.C、 foo has the value of true.D、 foo has the value of false.E、 An-exception is thrown.F、 The code will not compile.33.Aprogrammerneedstocreatealoggingmethodthatcanacceptanarbitrarynumberofarguments.Forexample,itmaybecalledintheseways: logIt("logmessage1"); logIt("logmessage2”,”logmessage3"); logIt("logmessage4","logmessage5","logmessage6"); Whichdeclarationsatisfiesthisrequirement()?A、publicvoidlogIt(String*msgs)B、publicvoidlogIt(String[]msgs)C、publicvoidlogIt(String...msgs)D、publicvoidlogIt(Stringmsg1,Stringmsg2,Stringmsg3)34.10. public class MyClass { 11. 12. public Integer startingI; 13. public void methodA() { 14. Integer i = new Integer(25); 15. startingI = i; 16. methodB(i); 17. } 18. private void methodB(Integer i2) { 19. i2 = Value(); 20. 21. } 22. } If methodA is invoked, which two are true at line 20?()A、 i2 == startingI returns true.B、 i2 == startingI returns false.C、 i2.equals(startingI) returns true.D、 i2.equals(startingI) returns false.35.class Flibitz{ public static void main(String[] args){ int grop=7; new Flibitz().go(grop); System.out.print(grop); } void go(int grop){ if(++grop>7) grop++; System.out.print(grop); } } 结果为:() A、99B、编译失败C、运行时异常被抛出D、77E、79F、9736.Given the web application deployment descriptor elements: 11. 12.ParamAdder 13.com.example.ParamAdder 14 24. 25.ParamAdder 26.MyServlet 27. 28. Which element, inserted at line 27,causes the ParamAdder filter to be applied when MyServlet is invokedby another servlet using the RequestDispatcher.include method?()A、B、INCLUDEC、includeD、INCLUDEE、include37.You have been contracted to create a web site for a free dating service. One feature is the ability for oneclient to send a message to another client, which is displayed in the latter client’s private page. Yourcontract explicitly states that security is a high priority. Therefore, you need to prevent cross-site hacking inwhich one user inserts JavaScript code that is then rendered and invoked when another user views thatcontent. Which two JSTL code snippets will prevent cross site hacking in the scenario above? ()A、${message}B、C、D、${message}E、38.class TestApp{ public static void main (String[ ] args){ for(int i=0;iA、0123B、012C、0123456789D、01245678939.如何暂停一个线程?()A、 调用System.pauseThred函数暂停B、 调用线程类的pauseThred函数暂停C、 调用Runnable接口的pauseThread函数暂停D、 调用Thred类的sleep静态函数暂停线程40.一辆以固定速度行驶的汽车,司机看到里程表上从左到右的读数和从右到左的读数是相同的,这个数是12321(公里),2小时后,里程表上再次出现一个新的对称数。问车的速度是多少公里/小时?41.t 是一个合法的 Thread 对象的引用,并且 t 的合法 run() 方法如下: public void run() { System.out.print("go "); } 及: t.start(); t.start(); t.run(); 哪一个是结果?() A、goB、go goC、go go goD、go 之后跟着一个异常42.Java源文件的后缀名是?() A、.classB、.cC、.javaD、.txt43.int i = 0, j = 1; if ((i++ == 1) && (j++ == 2)) { i = 42; } System.out.println(“i = “ + i + “, j = “ + j); What is the result?() A、 i = 1, j = 2B、 i = 1, j = 1C、 i = 42, j = 2D、 i = 42, j = 1E、 Compilation fails.44.输出流输出数据后,应调用哪个方法将其关闭?() A、stop()B、flush()C、exit()D、close()45.One of the use cases in your web application uses many session-scoped attributes. At the end of the usecase, you want to clear out this set of attributes from the session object. Assume that this static variableholds this set of attribute names: 201.private static final Set USE_CASE_ATTRS; 202.static { 203.USE_CASE_ATTRS.add("customerOID"); 204.USE_CASE_ATTRS.add("custMgrBean"); 205.USE_CASE_ATTRS.add("orderOID"); 206.USE_CASE_ATTRS.add("orderMgrBean"); 207.} Which code snippet deletes these attributes from the session object?()A、session.removeAll(USE_CASE_ATTRS);B、for( String attr : USE_CASE_ATTRS ){ session.remove(attr); }C、for( String attr : USE_CASE_ATTRS ){session.removeAttribute(attr);}D、for( String attr : USE_CASE_ATTRS ){session.deleteAttribute(attr);}E、session.deleteAllAttributes(USE_CASE_ATTRS);46.现有: int x = reader.read(); 下面哪一项正确?() A、 阅读器可以是FileReader或者BufferedReaderB、 阅读器不是FileReader或者BufferedReader类型C、 阅读器可以是FileReader类型,但不能是BufferedReader类型D、 阅读器可以是BufferedReader类型,但不能是FileReader类型47.Which is a valid identifier?() A、 falseB、 defaultC、 _objectD、 a-class48. What is the result()?A、 Compilation will succeed.B、 Compilation will fail at line 5.C、 Compilation will fail at line 6.D、 Compilation will fail at line 14.E、 Compilation will fail at line 17.49.如何定义继承关系?为“学生”类派生出“小学生”、“中学生”、“大学生”、“研究生”四个类,其中“大学生”类再派生出“一年级学生”、二年级学生”、“三年级学生”、“四年级学生”四个子类,“研究生”类再派生出“硕士生’’和“博土生’’两个子类。50.已知: 在横线处添加哪条语句运行时会产生异常()A、Aa=b;B、Ii=b;C、Cc=(C)b;D、Bd=(B)(A)b;51.简单变量和引用变量在作为类的成员这是时,有什么区别() A、简单成员变量不需要初始化,引用变量需要在构造函数中初始化B、引用成员变量不需要初始化,简单成员变量需要在构造函数中初始化C、类的成员变量可以自动初始化,因此没有区别D、简单成员变量会自动初始化为默认值(0),而引用变量只会自动初始化为空值,实际使用时还需要将它指向一个对象52.What is the result?() A、Compilation fails because of an error in line 3.B、Compilation fails because of an error in line 7.C、Compilation fails because of an error in line 9.D、If you define D e = new E(),then e.bMethod() invokes the version of bMethod() defined in Line 5.E、If you define D e = (D)(new E()),then e.bMethod() invokes the version of bMethod() defined in Line 5.F、If you define D e = (D)(new E()),then e.bMethod() invokes the version of bMethod() defined in Line 9.53.int x= 10; do { x--; } while(xA、 ten timesB、 zero timesC、 one to me timesD、 more than ten times54.For which three events can web application event listeners be registered?()A、When a session is createdB、After a servlet is destroyedC、When a session has timed outD、When a cookie has been createdE、When a servlet has forwarded a requestF、When a session attribute value is changed55.Which two prevent a servlet from handling requests.?()A、 The servlet’s init method returns a non-zero status.B、 The servlet’s init method throws a Servlet ExceptionC、 The servlet’s init method sets the Servlet Response’s context length to 0D、 The servlet’s init method sets the Servlet Response’s content type to null.E、 The servlet’s init method does NOT return within a time period defined by the servletcontainer.56.求三位数中,个位数字与十位数字之和除以10所得的余数是百位数字,且百位数字是偶数的数的个数。57.Which statement of assigning a long type variable to a hexadecimal value is correct?()A、 long number = 345L;B、 long number = 0345;C、 long number = 0345L;D、 long number = 0x345L;58.Which thetwo are concerning the objects available to developers creating tag files?()A、 The session object must be declared explicity.B、 The request and response objects are available implicity.C、 The output stream is available through the implicit outStream object.D、 The servlet context is available through the implicit servletContext object.E、 The JspContext for the tag file is available through the implicit jspContext object.59.Click the 'Select and Place' button. Place the events in the order they occur. 60.Which three are valid URL mappings to a servlet in a web deployment descriptor? ()A、 */*B、 /*.doC、 myServletD、 /MyservletE、 /MyServlet/*F、 MyServlet/*.isp61.现有如下类型: a - java.util.Hashtable b - java.util.List c - java.util.ArrayList d - java.util.SortedSet 和定义: 1-使用本接口,允许用户控制集合中每个元素的插入位置。 2-使用本集合,确保用户可以按照递增或元素的自然顺序遍历集合。 3-本具体类型允许空元素及基于索引的访问。 4-本集合是同步的。 哪一组匹配是对的?() A、2描述d; 3描述b。B、1描述b; 3描述c。C、3描述a; 4描述b。D、4描述a; 2描述c。62.11. double d = Math.random(); Which is true about d after line 11?() A、 d >= 1.0B、 0.0 63.求数列2,4,8,16,32,…前若干项之和。当和大于9000时,终止求和并输出结果64.在类Acoount中,正确引入类school.Student的语句是哪一项?() A、import schoolB、import schllo.*C、package school.StudentD、import Student65.Which two demonstrate encapsulation of data? ()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.66.Click the Exhibit button. The h:highlight tag renders its body, highlighting an arbitrary number of words, each of which is passed asan attribute (word1, word2, ...). For example, a JSP page can invoke theh:highlight tag as follows: 11. 12. high medium low 13. Given that HighlightTag extends SimpleTagSupport,which three steps are necessary to implement the taghandler for the highlight tag?()A、Add a doTag methodB、Add a doStartTag methodC、Add a getter and setter for the color attributeD、Create and implement a TagExtraInfo classE、Implement the DynamicAttributes interfaceF、Add a getter and setter for the word1 and word2 attributes67.public class SyncTest { private int x; private int y; public synchronized void setX (int i) (x=1;) public synchronized void setY (int i) (y=1;) public synchronized void setXY(int 1)(set X(i); setY(i);) public synchronized Boolean check() (return x !=y;) } Under which conditions will check () return true when called from a different class? A、 Check() can never return true.B、 Check() can return true when setXY is called by multiple threads.C、 Check() can return true when multiple threads call setX and setY separately.D、 Check() can only return true if SyncTest is changed to allow x and y to be set separately.68.程序: class TestApp{ public static void main(String[] args){ System.out.println(multiply(2,3,4,5)); } public int multiply(int[] nums){ int result = 1; for(int x :nums) result *= x; return result; } } 程序运行后的输出是哪项?() A、 14B、 编译错误C、 120D、 2469.What is the result?() A、0B、1C、4D、Compilation fails.E、An exception is thrown at runtime.70.怎样进行文件及目录的管理?71.Which two JSTL URL-related tags perform URL rewriting?()A、UrlB、LinkC、ParamD、ImportE、Redirect72.public class Yippee2 { static public void main(String [] yahoo) { for(int x= 1; xSystem.out.print(yahoo[x] + “ “); } } } and the command line invocation: java Yippee2 a b c What is the result?() A、a bB、b cC、a b cD、 Compilation fails.E、 An exception is thrown at runtime.73.Which code, inserted at line 14, sets the value of b to 314.159,26?() A、b=nf.parse(input);B、b=nf.format(input);C、b=nf.equals(input);D、b=nf.parseObject(input);74.设计一个圆类,将圆的位置(圆心坐标和半径)作为属性(提供任意圆的设置),并能计算圆的面积。75.Given: 3.class MyServlet extends HttpServlet { 4.public void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException,IOException { 5.// servlet code here ... 26.} 27.} If the DD contains a single security constraint associated with MyServlet and its only tagsand tags are:GETPUT Admin Which four requests would be allowed by the container?()A、A user whose role is Admin can perform a PUT.B、A user whose role is Admin can perform a GET.C、A user whose role is Admin can perform a POST.D、A user whose role is Member can perform a PUT.E、A user whose role is Member can perform a POST.F、A user whose role is Member can perform a GET.第2卷一.参考题库(共75题)1.1. class Pizza { 2. java.util.ArrayList toppings; 3. public final void addTopping(String topping) { 4. toppings.add(topping); 5. } 6. } 7. public class PepperoniPizza extends Pizza { 8. public void addTopping(String topping) { 9. System.out.println(”Cannot add Toppings”); 10. } 11. public static void main(String[] args) { 12. Pizza pizza = new PepperoniPizza(); 13. pizza.addTopping(”Mushrooms”); 14. } 15. } What is the result?() A、 Compilation fails.B、 Cannot add ToppingsC、 The code runs with no output.D、 A NullPointerException is thrown in Line 4.2.class MyApp{ public static void main(String[] args){ int age; System.out.println(“age=”+age); } } 执行上述代码后输出的结果是哪项?() A、age=0B、age=nullC、age=D、程序编译错误3.Use the operators "", which statements are true? () A、 0000 0100 0000 0000 0000 0000 0000 0000>5 gives 1111 1110 0000 0000 0000 0000 0000 0000D、 1100 0000 0000 0000 0000 0000 0000 0000>>5 gives 0000 0110 0000 0000 0000 0000 0000 00004.利用Applet类和Runnable接口实现滚动字幕,其中字幕文字(“学好Java有工作”)和时间间隔(“200”)需要由页面文件中标记的子标记传递。5.Upon a user’s first visit to the website, which two operations are always performed when the getSession method is called with no arguments in a servlet?()A、 All URLs returned by the server are rewritten.B、 An HttpSession object is created if necessary.C、 The user name and password of the user are checked.D、 The session ID is stored in the HTTP response as a cookie.6.public class Test { public static void main(String [] args) { int x =5; boolean b1 = true; boolean b2 = false; if((x==4) && !b2) System.out.print(”l “); System.out.print(”2 “); if ((b2 = true) && b1) System.out.print(”3 “); } } What is the result?() A、 2B、 3C、 1 2D、 2 3E、 1 2 3F、 Compilation fails.G、 Au exceptional is thrown at runtime.7.Which statement is true about the class of an object that can reference the variable base?() A、It can be any class.B、No class has access to base.C、The class must belong to the geometry package.D、The class must be a subclass of the class Hypotenuse.8.1. import java.util.*; 2. public class TestSet { 3. enum Example { ONE, TWO, THREE } 4. public static void main(String[] args) { 5. Collection coll = new ArrayList(); 6. coll.add(Example.THREE); 7. coll.add(Example.THREE); 8. coll.add(Example.THREE); 9. coll.add(Example.TWO); 10. coll.add(Example.TWO); 11. coll.add(Example.ONE); 12. Set set = new HashSet(coll); 13. } 14. } Which statement is true about the set variable on line 12?() A、 The set variable contains all six elements from the coll collection, and the order is guaranteed to be preserved.B、 The set variable contains only three elements from the coll collection, and the order is guaranteed to be preserved.C、 The set variable contains all six elements from the coil collection, but the order is NOT guaranteed to be preserved.D、 The set variable contains only three elements from the coil collection, but the order is NOT guaranteed to be preserved.9.A programmer has an algorithm that requires a java.util.List that provides an efficient implementation of add(0,object), but does NOT need to support quick random access. What supports these requirements?() A、 java.util.QueueB、 java.util.ArrayListC、 java.util.LinearListD、 java.util.LinkedList10.public class Foo { public void main( String[] args ) { System.out.println( “Hello” + args[0] ); } } What is the result if this code is executed with the command line?()A、 HelloB、 Hello FooC、 Hello worldD、 Compilation fails.E、 The code does not run.11.Which statement is true?() A、Compilation succeeds.B、class A does not compile.C、The method declared on line 9 cannot be modified to throw TestException.D、TestA compiles if line 10 is enclosed in try/catch block that catches TestException.12.以下函数中,不是Object类所有的是() A、notifyB、valueOfC、toStringD、wait13.程序员想要创建一个名为MyThread的类以便在main方法中用Thread实例化。对于下面三行: MyThread必须继承Thread。 MyThread必须实现Thread。 MyThread必须覆盖public void run()。 有几行是正确的() A、 0B、 1C、 2D、 314.What is the output?() A、42B、420C、462D、4204215.Given a correctly compiled class whose source code is: package com.sun.sjcp; public class Commander { public static void main(String[] args) { // more code here } } Assume that the class file is located in /foo/com/sun/sjcp/, the current directory is /foo/, and that the classpath contains “.“ (current directory). Which command line correctly runs Commander?() A、 java CommanderB、 java com. sim. sjcp.CommanderC、 java com/sun/sjcp/CommanderD、 java -cp com.sun.sjcp CommanderE、 java -cp com/sun/sjcp Commander16.Applet的布局设置默认是FlowLayout,F列哪项代码可以改变Applet的布局方式? ()A、 setLayoutManager(new GridLayout());B、 setLayout (new GridLayout(2,2));C、 setGridLayout (2,2);D、 setBorderLayout();17.package geometry; public class Hypotenuse { public InnerTriangle it = new InnerTriangle(); class InnerTriangle { public int base; public int height; } } Which is true about the class of an object that can reference the variable base? ()A、 It can be any class.B、 No class has access to base.C、 The class must belong to the geometry package.D、 The class must be a subclass of the class Hypotenuse.18.求1~200之间勾股数的组数(如a*a+b*b=c*c,则a,b,c为一组勾股数)19.现有: class Wrench f public static void main(String [] args) { Wrench w=new Wrench(); Wrench w2=new Wrench(); w2=go (w, w2); System.out.print (w2==w); } static Wrench go (Wrench wrl, Wrench wr2) { Wrench wr3=wrl; wrl=wr2; wr2=wr3; return wr3; } 结果是什么?() A、 falseB、 trueC、编译失败D、运行的时候有异常抛出20.接口中只能包含抽象方法,不能包含实例方法21.Which three code fragments, added individually at line 29, produce the output 100?() A、n = 100;B、i.setX(100);C、o.getY().setX(100);D、i = new Inner(); i.setX(100);E、o.setY(i); i = new Inner(); i.setX(100);F、i = new Inner(); i.setX(100); o.setY(i);22. Which two are true()A、 Line 13 is not valid for a servlet declarationB、 Line 14 is not valid for a servlet declarationC、 One instance of the servlet will be loaded at startupD、 Ten instance of the servlet will be loaded at start upE、 the servlet will be referenced by the name catalog in mappings23.class Flow { public static void main(String [] args) { try { System.out.print("before "); doRiskyThing(); System.out.print("after "); } catch (Exception fe) { System.out.print("catch "); } System.out.println("done "); } public static void doRiskyThing() throws Exception { // this code returns unless it throws an Exception } } 可能会产生下面哪两项结果?() A、beforeB、before catchC、before after
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 赣州师范高等专科学校《高级业绩管理》2023-2024学年第一学期期末试卷
- 赣南师范大学科技学院《健美运动》2023-2024学年第一学期期末试卷
- 预防艾滋病安全教育课件
- 赣东学院《可持续发展》2023-2024学年第一学期期末试卷
- 中小学生电脑制作课件
- 七年级语文上册单元清二新人教版
- 七年级道德与法治上册第二单元友谊的天空第五课交友的智慧第1框让友谊之树常青说课稿新人教版
- 三年级数学上册6多位数乘一位数综合与实践数字编码导学案新人教版
- 三年级科学上册第三单元天气与我们的生活第十七课大雁南飞教案青岛版
- 2022年东北林业大学自考英语(二)练习题(附答案解析)
- 数据中心供电系统应用方案
- (正式版)SH∕T 3507-2024 石油化工钢结构工程施工及验收规范
- 中东及非洲注塑成型模具行业现状及发展机遇分析2024-2030
- 牡丹江2024年黑龙江牡丹江医科大学招聘109人笔试历年典型考题及考点附答案解析
- 贵州省黔西南布依族苗族自治州2023-2024学年六年级下学期6月期末语文试题
- 泰州市2022-2023学年七年级上学期期末数学试题【带答案】
- JGJ276-2012 建筑施工起重吊装安全技术规范 非正式版
- 2019电子保单业务规范
- 学堂乐歌 说课课件-2023-2024学年高中音乐人音版(2019) 必修 音乐鉴赏
- 幕墙工程材料组织、运输装卸和垂直运输方案
- 灌溉用水循环利用技术
评论
0/150
提交评论