问题: Given the following code, which code fragments, when inserted at the indicated location, will succeed in making the program display a button spanning the whole window area?() import java.awt.*; public class Q1e65 { public static void main(String args[]) { Window win = new Frame(); Button but = new Button("button"); // insert code fragment here win.setSize(200, 200); win.setVisible(true); } } A、win.setLayout(new BorderLayout()); win.add(but);B、win.setLayout(new GridLayout(1, 1)); win.add(but);C、win.setLayout(new BorderLayout()); win.add(but, BorderLayout.CENTER);D、win.add(but);E、win.setLayout(new FlowLayout()); win.add(but);
查看答案
问题:下列哪项是String的字面量?() A、“Hello”B、‘world’C、/u2345D、new String(“good”)
问题: A developer is designing a multi-tier web application and discovers a need to hide the details of establishingand maintaining remote communications from the client. In addition, the application needs to find,in a transparent manner,the heterogeneous business components used to service the client’s requests. Which design patterns, working together, address these issues?()A、Business Delegate and Transfer ObjectB、Business Delegate and Service LocatorC、Front Controller and Business DelegateD、Intercepting Filter and Transfer Object
问题: Consider the following class: class Test(int i) { void test(int i) { System.out.println(“I am an int.”); } void test(String s) { System.out.println(“I am a string.”); } public static void main(String args) { Test t=new Test(); char ch=“y”; t.test(ch); } } Which of the statements below is true?()A、 Line 5 will not compile, because void methods cannot be overridden.B、 Line 12 will not compile, because there is no version of test() that rakes a charargument.C、 The code will compile but will throw an exception at line 12.D、 The code will compile and produce the following output: I am an int.E、 The code will compile and produce the following output: I am a String.
问题: 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.
问题:Which of the following fragments might cause errors?() A、 String s = "Gone with the wind";String t = " good ";String k = s + t;B、 String s = "Gone with the wind";String t;t = s[3] + "one";C、 String s = "Gone with the wind";String standard = s.toUpperCase();D、 String s = "home directory";String t = s - "directory";
问题:Which three form part of correct array declarations?() A、 public int a []B、 static int [] aC、 public [] int aD、 private int a [3]E、 private int [3] a []F、 public final int [] a
问题:Which statements concerning the event model of the AWT are true?() A、At most one listener of each type can be registered with a component.B、Mouse motion listeners can be registered on a List instance.C、There exists a class named ContainerEvent in package java.awt.event.D、There exists a class named MouseMotionEvent in package java.awt.event.E、There exists a class named ActionAdapter in package java.awt.event.
问题: 现有: public class Tester { public static void main (String[] args) { intx-5; Integer xl=x; Integer x2=x; int x3=new Integer(5); system..ut.print(x1.equals(x)); system..ut.print(xl==x); system..ut.print(x2.equals(xl)); system..ut.print(x2==xl); system..ut.print(x2==x3); system..ut.print(x2.equals(x3)); } } 结果为:() A、编译失败B、falsefalsetruetruetruetrueC、truetruetruetruetruetrueD、falsefalsetruetruetruefalseE、truefalsetruefalsefalsetrueF、运行时异常被抛出
问题:Which of the following statements about variables and their scopes are true? () A、 Instance variables are member variables of a class.B、 Instance variables are declared with the static keyword.C、 Local variables defined inside a method are created when the method is executed.D、 Local variables must be initialized before they are used.
问题: 现有: 1. class Book { 2. private final void read() { System.out.print("book "); } 3. } 4. class Page extends Book { 5. public static void main(String [] args) { 6. // insert code here 7. } 8. private final void read() { System.out.print("page "); } 9. } 和如下三个代码片段 ( x, y, z ): x. // just a comment y. new Page().read(); z. new Book().read(); 分别插入到第6行,有几个允许代码通过编译并可以运行且无异常?() A、 0B、 1C、 2D、 3
问题:能够遍历泛型List〈Integer〉 al中的所有元素的语句是哪项?() A、for(Integer i : al)B、for(i : al)C、for(al)D、forEach(Integer i : al)
问题:以下有关接口的叙述错误的是哪项?() A、 一个类可以实现多个接口B、 接口不能被继承C、 类实现接口时必须实现其中的方法D、 接口中只能包含抽象方法和常量
问题: A Company.com developer is designing the presentation tier for a web application that relies on a complex session bean. The session bean is still being developed and the APIs for are NOT finalized. Any changes to the session bean API directly impacts the development of the presentation tier. Which design pattern provides a means to manage the uncertainty in the API?()A、 View HelperB、 Front ControllerC、 Composite ViewD、 Intercepting FilterE、 Business DelegateF、 Chain of Responsibility
问题: package test1; public class Test1 { static int x = 42; } package test2; public class Test2 extends test1.Test1 { public static void main(String[] args) { System.out.println(“x = “ + x); } } What is the result?() A、 x = 0B、 x = 42C、 Compilation fails because of an error in line 2 of class Test2.D、 Compilation fails because of an error in line 3 of class Test1.E、 Compilation fails because of an error in line 4 of class Test2.
问题: 5. String foo = “base”; 6. foo.substring(0,3); 7. foo.concat(“ket”) 8. Type the value of foo at line 8.()
问题:Java中方法绑定有哪些形式?()A、编译时刻绑定B、运行时刻绑定C、静态绑定D、私有绑定
问题:HTTP中的POST和GET在下列哪些方面有区别()。A、数据位置B、明文密文C、数据安全D、长度限度E、应用场景
问题:设 x = 1 ,y = 2 , z = 3, 则表达式 y+=z--/++x 的值是()A、 3B、 3.5C、 4D、 5
问题:ServletContext对象是如何创建的()A、由 Servlet容器创建,对于每个HTTP请求.Servlet容器都会创建一个ServletContext对象B、由JavaWeb 应用本身为自己创建一个ServletContext对象C、由Servlet容器创建,对于每个JaveWeb应用,在启动时,Servlet容器都会创建一个ServletContext对象