yumbi吧 关注:15贴子:42
  • 3回复贴,共1
01、{Java题目}在Java中,要建立一个线程,可以从下面哪一个接口继承。(选择1项)
A) Runnable
02. {Java题目}java中定义一个类可以同时继承两个类(选择正确的1项)

03. {Java题目}接口中可以存在已实现的方法(选择正确的1项)

04. {Java题目}在JAVA中,能实现多重继承效果的方式是(   ) 。(选择1项)
接口
05、{Java题目}下列说法错误的有( )(选择2项)
      A)   数组是一种对象。                       B)   数组属于一种原生类。
      C)   int number=[]={31,23,33,43,35,63};        D)   动态数组的大小可以任意改变。
07. {Java题目}一个事件源必须注册监听器才能接收一个事件通知,以将产生的事件对象传输给(    )来处理。(选择正确的1项)
A   事件代理(监听器)          B   事件源
C   主程序                   D   事件处理方法
08. {Java题目}以下哪个监听器没有相应的适配器(   ). (选择正确的1项)
A   ActionListener            B   MouseListener
C   KeyListener              D   FocusListener
09.   {Java题目}JPanel组件的默认布局管理器是(   )(选择1项)
A   GridLayout              B   CardLayout
C   BorderLayout            D   FlowLayout
10. {Java题目}在Java中,关键字()使类不能派生出子类。(选择1项)
A)   final   
11. {Java题目}在Java语言中,类Worker是类Person的子类,Worker的构造方法中有一句“super( )”,该语句()。(选择1项)
C)   调用类Person的构造方法
12. {Java题目}现在有一个接口iPerson与一个类Chinese,Chinese试图实现iPerson接口,如下项目中哪个是正确的写法(   )(选择1项)
D)   class Chinese implements iPerson{}
13. {Java题目}在Java语言中,声明公有的abstract方法的格式是()。(选择1项)
A)   public abstract void add();
14. {Java题目} 关于Java语言的内存回收机制,下列选项中正确的是(   )。(选择1项)
A   Java程序要求用户必须手工创建一个线程来释放内存
B   Java程序允许用户使用指针来释放内存
C   内存回收线程负责释放无用内存
D   内存回收线程不能释放内存对象
15. {Java题目}下列整型常量 i 的定义中,正确的是(C   )。(选择1项)
A)   final i;                    B)   static int i;
C)   static final int   i=234;    D)   final float i=3.14f;



IP属地:北京1楼2010-04-28 23:20回复
    16. {Java题目}设有定义 int a = 12 ;则执行a*= 12;语句后,a 的值为( A)。(选择1项)
    A)   144         B)   12        C)   24        D)   0
    17. {Java题目}   进行Java基本的GUI设计需要用到的包是(   )。(选择1项)
    A   java.io      B   java.sql    C   java.awt    D   java.rmi
    18. {Java题目}   选择错误的标识符。(选择2项)
    A)   IDoLikeTheLongNameClass          B)   abyte         C)   const        D)   3_case
    18. {Java题目}   选择错误的标识符。(选择1项)CD
          A   $bye          B   abyte        C   IDoLikeTheLongNameClass        D   3_case
    19. {Java题目}指出下列哪个方法与方法public void add(int a){}为合理的重载方法(BCD   )。 (选择3项)
    A)   public int add(int a)          B)   public void add(long a)
    C)   public int add(long a)         D)   public void add(float a)
    20. {Java题目}下列哪个方法可用于创建一个可运行的类( A ) (选择1项)
    A)   public class X implements Runnable{ public void run(){ ......} }
    B)   public class X implements Thread{ public void run(){ ......} }
    C)   public class X implements Thread{ public int run(){ ......} }
    D)   public class X implements Runnable{ protected void run(){ ......} }
    21. {Java题目}Java中,在单一文件中import、class 和package的正确出现顺序是(B)。(选择1项)                      
    A) class, import, package        B)   package, import, class
    C) import, package, class        D)   package, class, import
    22. {Java题目}在Java语言中,在程序运行时会自动检查数组的下标是否越界,如果越界,会抛出下面的(C)异常。(选择1项)
    A)   NullpointerException
    B)   ArithmeticExceptioin
    C)   ArrayIndexOutOfBoundsException
    D)   SecurityManager
    23. {Java题目}算术表达式1+2/3-4*5的值为( B )。(选择1项)
    A)   1           B)   -19         C)   -5         D)   0
    24. {Java题目}执行代码String[] s=new String[10];后,哪个结论是正确的(   D) (选择1项)
           A)   s[10] 为 "";               B)   s[10] 为 null;
    


    IP属地:北京2楼2010-04-28 23:20
    回复
             System.out.println("So true");
           }
      C)   int i = 1;
           int j = 2;
           if (i == 1 || j == 2) {
             System.out.println("OK");
           }
      D)   int i = 1;
           int j = 2;
           if (i == 1 & | j == 2) {
             System.out.println("OK");
           }
      42、{Java题目}下列代码执行的结果是( C )(选择1项)
      public class text {
         public static void main(String[] args) {
           int x= 1, y = 6;
         while (y--==6) {x--;}
         System.out.println("x=" + x +" ,y =" + y);
            }
      }
      A)程序能运行,输出结果:x=0,y=5       B)程序能运行,输出结果:x=-1,y=4
      C)程序能运行,输出结果:x=0,y=4       D)程序不能编译
      43、{Java题目}以下Java代码编译运行后,下列选项中,(ACD)会出现在输出结果中。
      (选择3项)
      public class text3{
          public static void main(String args[]) {
      for(int i=0;i<3;i++) {
          for(int j=3;j>=0;j--) {
             if(i == j)
                continue;
             System.out.println(“i=”+i+“j=”+j);
          }
      }
          }
      }
      A)i=0 j=3     B)i=0 j=0     C)i=0 j=2     D)i=0 j=1
      44、{Java题目}分析下列Java代码, 编译运行后,输出结果是(C)。(选择一项)
      class A{
         public static void main(String[] args){
      method();
         }
         static void method(){
      try{
         System.out.println(“Hello”);
      }
      finally{
         System.out.println(“good-bye”);
      }
         }
      }
      A)“Hello”     B)“good-bye”     C)“hello”“good-bye”     D)代码不能编译
      45、{Java题目}下面程序的输出结果是。(选择1项)A
      public class ex2 {
      public static void main(String[] args)
      {
      for(int cnt=0;cnt<10;cnt++)
      {
      if(cnt==5)
      break;
      System.out.print(cnt);
      }
      }
      }
      A)0 1 2 3 4     B)6 7 8 9     C)0 1 2 3 4 6 7 8 9     D)5
      46、{Java题目}给定下面的代码片段: D
      public class ex1 {
      public void Test() {
      try {
      method();
      }
      catch (ArrayIndexOutOfBoundsException e){
      System.out.println("Exception1");
      }
      catch(Exception e) {
      System.out.println("Exception2");
      }
      finally{
      System.out.println("Thank you!");
      }
      }
      public void method() {
      //...
      }
      public static void main(String[] args) {
      ex1 obj=new ex1();
      obj.Test();
      }
      } 如果函数method正常运行并返回,会显示下面的哪些信息?(选择1项)
      A)Hello World     B)Exception1     C)Exception2     D)Thank you!
      


      IP属地:北京5楼2010-04-28 23:20
      回复
        47、{Java题目}考虑下列代码, 描述正确的是:(C   )(选择1项)
        1.   class Test{    
        2.      void test(int i){
        3.          System.out.println("I am an int");
        4.     }    
        5.      void test(String s){
        6.          System.out.println("I am a String");
        7.     }
        8.      public static void main(String args[]){        
        9.          Test t= new Test();
        10.          char ch = 'y';
        11.          t.test(ch);
        12.     }
        13.   }
        A)第11行不能编译, 因为参数不对.      B)代码能编译,但在第11行出现运行时异常.
        C)输出结果: I am an int.              D)输出结果: I am a String.
        48、{Java题目}指出下列程序运行的结果( B) (选择1项)
        public class Example{
             String str=new String("good");
             char[]ch={'a','b','c'};
             public static void main(String args[]){
                 Example ex=new Example();
                 ex.change(ex.str,ex.ch);
                 System.out.print(ex.str+" and ");
                 System.out.print(ex.ch);
             }
             public void change(String str,char ch[]){
                 str="test ok";
                 ch[0]='g';
             }
        }
        A)good and abc      B)good and gbc      C)test ok and abc      D)test ok and gbc
        49、{Java题目}java程序题目(选择1项)D
        class base
        {
             public void show(){
                 System.out.print("base");
             }
        }
        class sub extends base{
             public void show(){
                 System.out.print("sub");
             }
             public void print(){
                 System.out.print("hello");
             }
             public static void main(String args[]){
                 base t=new sub();
                 t.show();
                 t.print();
             }
        }
        输出结果是( )
        A)base hello     B)sub   hello     C)base sub     D)编译报错
        50、{Java题目}下列代码的执行结果是?( D   )(选择1项)
             int i=1, j=0;
              switch(i) {
        case 2:
        j+=6;
        case 4:
        j+=1;
        default:
        j +=2;
        case 0:
        j +=4;
        }
        System.out.println("j="+j);
        A) 程序能运行,输出结果:j=0           B) 程序能运行,输出结果:j=2
        C) 程序能运行,输出结果:j=4           D) 程序能运行,输出结果:j=6
        


        IP属地:北京6楼2010-04-28 23:20
        回复