沈师 Java程序设计 PTA 选择题 无答案版

答案链接:https://blog.csdn.net/a2272062968/article/details/117700744

  1. Java语言具有许多优点和特点,哪个反映了Java程序并行机制的特点?( )
    A. 安全性
    B. 多线性
    C. 跨平台
    D. 可移植

  2. What must all Java applications contain? 分值为2分。
    A. an applet
    B. a final class
    C. a main method
    D. an applet class

  3. What is the extension of a Java bytecode file? 分值为2分。
    A. .class
    B. .cls
    C. .java
    D. .jvm

  4. 一个计算机上安装JDK后,该计算机不包含的是()。
    A. JRE
    B. JVM
    C. Eclipse
    D. javac.exe

  5. 对JVM来说,可执行文件的扩展名正确的是( )。
    A. java
    B. class
    C. dll
    D. pyc

  6. 哪一种类型的代码被JVM解释成本地代码?
    A. 源代码
    B. 处理器代码
    C. 字节码
    D. .exe可执行代码

  7. Java 语言的特点不包括( )
    A. 平台无关
    B. 面向对象
    C. 多重继承
    D. 支持多线程

  8. 有一段java 应用程序,它的主类名是a1,那么保存它的源文件名可以是( ).
    A. a1.java
    B. a1.class
    C. a1
    D. 都对

  9. 编译Java源文件和解释执行Java字节码文件的指令分别是什么?
    A. javac.exe和javadoc.exe
    B. java.exe和jdb.exe
    C. jad.exe和java.exe
    D. javac.exe和java.exe

  10. 编译Java源程序文件将产生相应的字节码文件,这些字节码文件的扩展名为( )。
    A. .byte
    B. .class
    C. .html
    D. .exe

  11. 在Java中,负责对字节代码解释执行的是( )。
    A. 应用服务器
    B. 虚拟机
    C. 垃圾回收器
    D. 编译器

  12. 在windows平台上安装配置JDK时,下列的说法错误的是_____。
    A. 设置path的作用是指定命令搜索路径
    B. 设置CLASSPATH的作用是指定类搜索路径
    C. javac的功能是编译并执行 java代码项
    D. 假设JDK的安装位置是:c:\java,那么应在path中加入下面的数据项:c:\java\bin

  13. Java语言中的运行机制是什么?
    A. 编译型
    B. 解释型
    C. 半编译半解释型
    D. 编译和解释型

  14. 在Java类的定义中,程序执行入口声明如下,哪一个是错误的程序代码?
    A. public static void main(String args){ }
    B. public static void main(String[ ] args){ }
    C. public static void main(String args[ ]){ }
    D. public static void main(String message[ ]){ }

  15. MAX_LENGTH是int型public成员变量,变量值保持为常量55,用简短语句定义这个变量( )。
    A. public int MAX_LENGTH=55
    B. final int MAX_LENGTH=55
    C. final public int MAX_LENGTH=55
    D. public final int MAX_LENGTH=55

  16. 假设有如下程序:

public class Demo {
      public static void main(String args[]) {
            long num = 100 ;
            int x = num + 2 ;
            System.out.println(x) ;
     }
}

最终程序的执行结果是什么?
A. 102.0
B. 1002.0
C. 100.0
D. 程序错误

  1. Which of the following lines will compile without warning or error? 分值为2分。
    A. float f=1.3;
    B. int i=10;
    C. byte b=257;
    D. boolean b=null;

  2. 假设有如下程序:
    public class Demo {
    public static void main(String args[]) {
    String str = “” ;
    for (int x = 0 ; x < 5 ; x ++) {
    str += x ;
    }
    System.out.println(str) ;
    }
    }
    最终的执行结果是什么?
    A. 01234
    B. 10.0
    C. 14.0
    D. 25.0

  3. 当编译并运行下列程序段时,运行结果是什么?

public class Test {
    public static void main(String[ ] args) {
        int i=0;
        while (i--<0){
             System.out.println("The value of i is "+i);
         }
         System.out.println("The end");
     }
}
A. 编译时错误
B. 运行时错误
C. The end
D. The value of i is 0
  1. 以下程序段的输出结果是
class Test {
     public static void main(String[] args) {
        System.out.println(4 + 5 + "" + 3 + 6);
    }
}
A. 99
B. 4536
C. 936
D. 459
  1. 假设有如下程序:
public class Demo {
      public static void main(String args[]) {
             int sum = 0 ;
            int x = 10 ;
            while (x > 0) {
                sum += x ;
                        }
            System.out.println(sum) ;
       }
}

最终执行结果是什么?
A. 55.0
B. 10.0
C. 程序错误,死循环
D. 15.0

  1. What will happen when you attempt to compile and run the following code
int Output=10;
boolean b1 = false;
if((b1==true) && ((Output+=10)==20)){
    System.out.println("We are equal "+Output);
} else {
    System.out.println("Not equal! "+Output);
}
A. Compile error, attempting to preform binary comparison on logical data type
B. Compilation and output of "We are equal 10"
C. Compilation and output of "Not equal! 20"
D. Compilation and output of "Not equal! 10"
  1. What will be printed out if you attempt to compile and run the following code ?
int i=1;
switch (i) { 
case 0:    System.out.println("zero");    break; 
case 1:    System.out.println("one"); 
case 2:    System.out.println("two"); 
default:    System.out.println("default"); }
A. one
B. one, default
C. one, two, default
D. default
  1. 下面的方法,当输入为2的时候返回值是多少?( )
public int getValue(int i) {
         int result = 0;
         switch (i) {
            case 1:
                result = result + i;
            case 2:
                result = result + i * 2;
            case 3:
                result = result + i * 3;
        }
        return result;
 }
A. 0
B. 2
C. 4
D. 10
  1. For the code below:
boolean m = true;
if ( m=false )
System.out.println(False);
else
System.out.println(True);
What is the output? ( )
A. False
B. True
C. None
D. An error will occur when running
  1. 下列不可作为java语言标识符的是()。
    A. a2
    B. $2
    C. _2
    D. 22

  2. 编译运行以下程序后,关于输出结果的说明,正确的是( )。

public class Main {
    public static void main(String[] args) {
        int x = 4;
        System.out.println("value is "+((x>4)?99.9:9));
    }
}
A. 输出结果为: value is 99.99
B. 输出结果为: value is 9
C. 输出结果为: value is 9.0
D. 编译错误
  1. 有以下方法的定义,请选择该方法的返回类型( )。
ReturnType  method(byte x, double y)  {
    return  (short)x/y*2;
}
A. byte
B. short
C. int
D. double
  1. 下列选项中不属于本段代码输出结果的是( )
public class Main{
    public static void main(String args[]) {
      one:
      two:
      for(int i=0; i<3; i++) {
          three:
          for(int j=10; j<30; j+=10) {
             System.out.println(i+j);
             if(i>0)
                break one;
          }
      }
    }
}
A. 10
B. 20
C. 11
D. 21
  1. 下面( )表达式可以得到x和y中的最大值。
    A. x>y?y:x
    B. x<y?y:x
    C. x>y?(x+y):(x-y)
    D. x==y?y:x

  2. Which statement below is incorrect:
    A. float a = 2.0
    B. double b=2.0
    C. int c=2
    D. long d=2

  3. 下面哪单词是Java语言的关键字( )。
    A. Float
    B. this
    C. string
    D. unsigned

  4. Which line below will not generate warning or error when compiling? ( )
    A. float f = 1.3;
    B. char c = “a”;
    C. byte b = 257;
    D. int i = 10;

  5. Which switch-case below is NOT correct?
    A. int i; switch (i) { case…}
    B. String s; switch (s) { case…}
    C. char c; switch © { case…}
    D. boolean b; switch (b) { case…}

  6. 下列标识符(名字)命名原则中,符合规范的是___。
    A. 类名的首字母小写
    B. 变量和方法名的首字母大写
    C. 接口名的首字母小写
    D. 常量完全大写

  7. 设有变量定义: short a = 300; 则以下哪一条语句会导致编译错误?
    A. a += 3;
    B. a = (short)a + 3;
    C. a = (byte)(a + 3);
    D. a = (short)(a * 100);

  8. 以下选项中没有语法错误的是( ) 。
    A.

    while (int  i<7) {
       i++;
       System.out.println(“i is “+i);
    }
    

    B.

    int  j=3; while(j) {
       System.out.println(“ j  is “+j);
    }
    

    C.

    int  j=0;
    for(int  k=0; j + k !=10; j++,k++) {
        System.out.println(“ j  is “+ j + “k  is”+ k);
    }
    

    D.

    int  j=0;
    do{
    	System.out.println( “j  is “+j++);
     	if (j == 3) {
        	continue  loop;
     	}
    }while  (j<10);
    
  9. 循环执行后,count的值是( )

int count = 0;
do {
     System.out.println("Welcome to Java");
} while (count++ < 9);
System.out.println(count);
A. 11
B. 10
C. 9
D. 8
  1. Which variable definition below is valid in Java?
    A. boolean b;
    B. extern int i;
    C. unsigned int k;
    D. int i[10];

  2. 下面代码运行结果显示( )。

double temperature = 50;
if (temperature >= 100)
   System.out.println("too hot");
else if (temperature <= 40)
   System.out.println("too cold");
else
   System.out.println("just right");
A. too hot
B. too cold
C. just right
D. too hot too cold just right
  1. 整型数据类型中,需要内存空间最少的是( ).
    A. short
    B. long
    C. int
    D. byte

  2. 下面代码将输出( )行 “Welcome to Java”?。

int count = 0;
do {
     System.out.println("Welcome to Java");
} while (count++ < 10);
A. 10
B. 11
C. 9
D. 1
  1. For code below:
int i, j;
Loop1:                        //    1
for ( i=0; i<20; i++ ) {
    for ( j=0; j<i*i; j++ ) {
        if ( j*2 ==i )
            break Loop1;        //    2
    }
    i=4;                    //    3
}
i=5;                        //    4

After executing line 2, where will the program jump?
A. 1
B. 2
C. 3
D. 4

  1. 在Java中,以下程序段的输出结果是( )。
       int n=9;
       while(n>6){
           n--;
           System.out.print(n);
       }
A. 987
B. 876
C. 8765
D. 9876
  1. 分析下列代码的运行结果是什么?
void looper(){
    int x=0;
    one:
    while(x<20) {
        two:
            System.out.print(++x);
            if(x>3)
              break two;
    }
}
A. 编译错误
B. 0
C. 1
D. 2
  1. 在JAVA中,给定代码片段如下所示,则编译运行后,输出结果是()。
for (int i = 0; i < 10; i++) {
    if (i == 10 - i) {
        break;
    }

    if (i % 3 != 0) {
        continue;
    }
    System.out.print(i + " ");
}
A. 0
B. 0 3
C. 0 3 6
D. 0 3 6 9
  1. 当编译运行下列代码时,运行结果是什么?
public class Demo{
  public static void main(String args[]){
    int i=012;
    int j=034;
    int k=056;
    int l=078;
    System.out.println(i);
    System.out.println(j);
    System.out.println(k);
  }
}
A. 输出12,34和56
B. 输出24,68和112
C. 输出10,28和46
D. 编译错误
  1. 分析下面这段Java代码,它的运行结果是
Import java.io.\*;
Public class B{
    Public static void main(string [] args){
        int i=12;
        System.out.println(i+=i-=i*=i);
      }
}
A. 100
B. 0
C. -120
D. 程序无法编译
  1. Which is the value of temp after the code’s execution? ( )
long temp = (int)3.9;
temp %= 2;
A. 0
B. 1
C. 2
D. 3
  1. 以下( )添加到ComputerBook中不会出错
class Book{
    protected int getPrice(){
        return 30;
    }
}
public class ComputerBook extends Book{
}
A. protected float getPrice(){}
B. protected int getPrice(int page){}
C. int getPrice(){}
D. public int getPrice(){return 10;}
  1. 以下关于构造函数的描述错误的是( )。
    A. 构造函数的返回类型只能是void型。
    B. 构造函数是类的一种特殊函数,它的方法名必须与类名相同。
    C. 构造函数的主要作用是完成对类的对象的初始化工作。
    D. 一般在创建新对象时,系统会自动调用构造函数。

  2. 以下对继承的描述错误的是
    A. Java中的继承允许一个子类继承多个父类
    B. Java中的继承存在着传递性
    C. 父类更具有通用性,子类更具体
    D. 当实例化子类时会递归调用父类中的构造方法

  3. 下列说法正确的有() 。
    A. class中的constructor不可省略
    B. constructor必须与class同名,但方法不能与class同名
    C. constructor在一个对象被new时执行
    D. 一个class只能定义一个constructor

  4. 执行下面的程序,输出结果是( )。

public class Test {
        int x= 12;
         public void method(int x) {
               x+=x;
              System.out.println(x);
         }
         public static void main(String[] args){
                 Test t = new Test();
                 t.method(5);
         }
}
A. 5
B. 10
C. 12
D. 24
  1. 声明一个类是需要( )关键字。
    A. public
    B. private
    C. class
    D. 以上都是

  2. 下面程序的运行结果是( )

main() {
    int x=30;
    int[] numbers=new int[x];
    x=60;
    System.out.println(numbers.length);
}
A. 60
B. 20
C. 30
D. 50
  1. 以下程序运行结果是
public class Test extends Father{
    private String name="test";
    public static void main(String[] args){
        Test test = new Test();
        System.out.println(test.getName());
    }
}
class Father{
    private String name="father";
    public String getName() {
        return name;
    }
}
A. father
B. 编译出错
C. test
D. 运行出错,无输出
  1. 下列关于数组的声明哪一个是错误的。
    A. int[ ] a={1,2};
    B. int a[ ]={1,2};
    C. int[ ] a=new int[2];
    D. int a[2]={1,2};

  2. 对于类与对象的关系,以下说法错误的是( )。
    A. 类是对象的类型
    B. 对象由类来创建
    C. 类是同类对象的抽象
    D. 对象是创建类的模板

  3. 在面向对象方法中,继承定义了超类和子类的概念,子类在维持原有父类中方法签名不变的前提下,用适合于自己要求的实现去置换父类中的相应方法的实现称为____________。
    A. 继承
    B. 覆盖(overriding)
    C. 重载(overloading)
    D. 多态

  4. 声明成员变量时,如果不使用任何访问控制符(public, protected, private),则以下哪种类型的类不能对该成员进行直接访问 ( ) .
    A. 同一类
    B. 同一包中的子类
    C. 同一包中的非子类
    D. 不同包中的子类

  5. 对于构造方法,下列叙述不正确的是( )。
    A. 构造方法是类的一种特殊方法,它的方法名必须与类名相同
    B. 构造方法的返回类型只能是void型,即在方法名前加void
    C. 构造方法的主要作用是完成对类的对象的初始化工作
    D. 一般在创建新对象时,系统会自动调用构造方法

  6. 以下关于继承的叙述正确的是( )。
    A. 在Java中类只允许单一继承
    B. 在Java中一个类只能实现一个接口
    C. 在Java中一个类不能同时继承一个类和实现一个接口
    D. 在Java中接口只允许单一继承

  7. 下面说法不正确的是( )
    A. 一个子类的对象可以接收父类对象能接收的消息;
    B. 当子类对象和父类对象能接收同样的消息时,它们针对消息产生的行为可能不同;
    C. 父类比它的子类的方法更多;
    D. 子类在构造函数中可以使用super( )来调用父类的构造函数;

  8. 执行完以下代码int [ ] x = new int[10];后,以下哪项说明是正确的( )
    A. x[9]为0
    B. x[9]未定义
    C. x[10]为0
    D. x[0]为空

  9. 已知name,age是Person类的成员属性,关于构造方法,下面哪个描述是正确的?

A. 
	public void Person(String name){
    this.name=name;
} //这是Person类中的构造方法
B. 
	public Person(){
    name="";
    age=10;
}
public Person(String name){
    Person();
    this.name=name;
} //这是Person类中两个构造方法
C. 
public Person(String name){
    this();
    this.name=name;
} //这是Person类中唯一的构造方法
D. 
public Person(){
    name="";
    age=10;
}
public Person(String name){
    this();
    this.name=name;
} //这是Person类中两个构造方法
  1. 访问修饰符作用范围由大到小是( )
    A. private-default-protected-public
    B. public-default-protected-private
    C. private-protected-default-public
    D. public-protected-default-private

  2. 将以下哪种方法插入行3是不合法的。

1public  class  Test1{
2public  float  aMethod(float  a,float  b){   }
34}
A. public  float  aMethod(float  a, float  b,float  c){  }
B. public  float  aMethod(float  c,float d){  }
C. public  int  aMethod(int  a, int b){  }
D. private float aMethod(int a,int b,int c){  }
  1. 执行下面代码,下面描述正确的是( )。
public class Person{
   static int arr[] = new int[10];
   public static void main(String a[]){
     System.out.println(arr[1]);
   }
}
A. 产生编译错误
B. 输出空
C. 编译正确,运行错误
D. 输出0
  1. 定义了int型二维数组a[6][7]后,数组元素a[3][4]前的数组元素个数为( )
    A. 24
    B. 25
    C. 18
    D. 17

  2. Java程序默认引用的包是( )。
    A. java.text包
    B. java.awt包
    C. java.lang包
    D. java.util包

  3. A派生出子类B,B派生出子类C,对于如下Java源代码正确的说法是()。
    A a0 =new A();
    A a1 =new B();
    A a2 =new C();
    A. 只有第1行能通过编译
    B. 第1、2行能通过编译,但第3行编译出错
    C. 第1、2、3行能通过编译,但第2、3行运行时出错
    D. 第1行、第2行和第3行的声明都是正确的

  4. 以下对重载描述错误的是
    A. 方法重载只能发生在一个类的内部
    B. 构造方法不能重载
    C. 重载要求方法名相同,参数列表不同
    D. 方法的返回值类型不是区分方法重载的条件

  5. 下述哪条关于构造方法的说法,不符合Java语法的规定( )。
    A. 每个类至少有一个构造方法
    B. 构造方法必须与类同名
    C. 构造方法无返回值,其返回值类型必须写为void
    D. 构造方法可以是private的

  6. 下列关于使用包中的类哪个说法是正确的。
    A. 类不可以使用其所在包中的private类
    B. 类可以使用其他包中的所有类
    C. 类可以使用其他包中的public类
    D. 以上说法都不正确

  7. 下列选项中关于java中super关键字的说法错误的是
    A. super关键字是在子类对象内部指代其父类对象的引用
    B. super关键字不仅可以指代子类的直接父类,还可以指代父类的父类
    C. 子类可以通过super关键字调用父类的方法
    D. 子类可以通过super关键字调用父类的属性

  8. Java中( ) 。
    A. 一个子类可以有多个父类,一个父类也可以有多个子类
    B. 一个子类可以有多个父类,但一个父类只可以有一个子类
    C. 一个子类可以有一个父类,但一个父类可以有多个子类
    D. 上述说法都不对

  9. 方法体内定义的变量称局部变量,下述关于局部变量的说法中错误的是( )。
    A. 局部变量仅在所定义的代码块内(花括号对内)有效
    B. 局部变量不能加修饰词修饰
    C. 局部变量不能与类中的成员变量同名
    D. 局部变量未经赋值不能使用

  10. 下面说法正确的是()
    A. 如果源代码中有package语句,则该语句必须放在代码的第一行
    B. 如果源代码中有import语句,则该语句必须放在在代码的第一行
    C. 如果源代码中有main方法,则该方法必须被放在代码的第一行
    D. 如果某文件的源代码中定义了一个public的接口,接口名和文件名可以不同

  11. 定义了一维int型数组a[10]后,下面错误的引用是( ) 。
    A. a[0]=1
    B. a[10]=2
    C. a[0]=5*2
    D. a[1]=a[2]*a[0]

  12. 下面是People和Child类的定义和构造方法,每个构造方法都输出编号。在执行new Child(“mike”)的时候都有哪些构造方法被顺序调用?请选择输出结果 ( )

class People {
        String name;
        public People() {
               System.out.print(1);
        }
        public People(String name) {
               System.out.print(2);
               this.name = name;
        }
}
class Child extends People {
       People father;
       public Child(String name) {
              System.out.print(3);
              this.name = name;
              father = new People(name + ":F");
       }
       public Child(){
             System.out.print(4);
       }
}
A. 312
B. 32
C. 432
D. 132
  1. 关于被私有访问控制符private修饰的成员变量,以下说法正确的是( )
    A. 可以被三种类所引用:该类自身、与它在同一个包中的其他类、在其他包中的该类的子类
    B. 可以被两种类访问和引用:该类本身、该类的所有子类
    C. 只能被该类自身所访问和修改
    D. 只能被同一个包中的类访问

  2. 下面的概念,哪个不是关于对象的多态性的体现。
    A. 方法的重载
    B. 方法的继承
    C. 方法的覆盖
    D. 对象的上、下转型

  3. 一个*.java文件中可以包含多少个public类?
    A. 最多1个
    B. 最少1个
    C. 只能是0个
    D. 不限制

  4. 在Java中,一个类可同时定义许多同名的方法,这些方法的形式参数个数、类型或顺序各不相同,传回的值也可以不相同。这种面向对象程序的特性称为( )。
    A. 隐藏
    B. 覆盖
    C. 重载
    D. Java不支持此特性

  5. 类Teacher和Student是类Person的子类,下面的代码中最后一句语句的运行结果是( ).

Person p;
Teacher t;
Student s;
//p,t and s are all non-null.
if(t instanceof Person)  {s=(Student)t;}
A. 编译时正确,但运行时错误
B. 将构造一个Student对象
C. 表达式是错误的
D. 表达式是合法的
  1. 以下描述正确的有
    A. 方法的重写应用在一个类的内部
    B. 方法的重载与返回值类型无关
    C. 构造方法不能重载
    D. 构造方法可以重写

  2. 下面哪个函数是public void aMethod(){…}的重载函数?( )
    A. void aMethod( ){…}
    B. public int aMethod(){…}
    C. public void aMethod ( ){…}
    D. public int aMethod ( int m){…}

  3. 下列哪些语句关于Java内存回收的说明是正确的? ( )
    A. 程序员必须创建一个线程来释放内存
    B. 内存回收程序负责释放无用内存
    C. 内存回收程序允许程序员直接释放内存
    D. 内存回收程序可以在指定的时间释放内存对象

  4. 有以下程序片段,下列哪个选项不能插入到行1。( )

1)
2) public  class  Interesting{
3)      //do sth
4) }
A. import java.awt.*;
B. package mypackage;
C. class OtherClass{   }
D. public class MyClass{ }
  1. 下列方法头中哪一个不与其他方法形成重载(overload)关系?( )
    A. void mmm()
    B. void mmm(int i)
    C. void mmm(String s)
    D. int mm()

  2. 当访问无效的数组下标时,会发生( )。
    A. 中止程序
    B. 抛出异常
    C. 系统崩溃
    D. 直接跳过

  3. 给出下面代码,关于该程序以下哪个说法是正确的?( )

public class Person{
     static int arr[] = new int[5];
     public static void main(String a[]) {
          System.out.println(arr[0]);
     }
}
A. 编译时将产生错误
B. 编译时正确,运行时将产生错误
C. 输出0
D. 输出空
  1. 将以下哪种方法插入行6是不合法的。( ) 。
1public  class  Test1 {
2public  float  aMethod(float a,float b) throws
3IOException {      }
4}
5public  class  Test2  extends  Test1{
67}
A. float  aMethod(float  a,float  b){ }
B. public  int  aMethod(int a,int b)throws  Exception{ }
C. public  float  aMethod(float  p,float q){ }
D. public  int  aMethod(int a,int  b)throws IOException{ }
  1. 有一个类A,以下为其构造方法的声明,其中正确的是()。
    A. void A(int x){…}
    B. A(int x){…}
    C. a(int x){…}
    D. void a(int x){…}

  2. 下列数组声明,下列表示错误的是( )
    A. int[ ] a
    B. int a[ ]
    C. int[ ][ ] a
    D. int[ ]a[ ]

  3. 下面关于缺省构造方法的描述中正确的是( )。
    A. 当类中没有定义任何构造方法时,Java编译器将为这个类创建缺省构造方法
    B. 缺省构造方法可以初始化其他方法中定义的变量
    C. Java编译器会为所有的类创建缺省构造方法。
    D. 如果在一个类中定义的构造方法都声明了参数,Java编译器将为这个类创建一个缺省构造方法

  4. 类中某方法定义如下: double fun(int a,int b){ return a*1.0/b; } 同一类内其它方法调用该方法的正确方式是( )。
    A. double a = fun(1,2)
    B. double a = fun(1.0,2.0)
    C. int x = fun(1,2)
    D. int x = fun(1.0,2.0)

  5. 下列语句会造成数组new int[10]越界是( )。
    A. a[0] += 9;
    B. a[9]=10;
    C. a[9]
    D. for(int i=0;i<=10;i++) a[i]++;

  6. 对于构造方法,下列叙述不正确的是( )。
    A. 构造方法的方法名必须与类名相同
    B. 构造方法的返回类型只能是void型
    C. 构造方法可以对该类对象的实例变量进行初始化工作
    D. 一般在创建新对象时,系统会自动调用构造方法

  7. 一个类在重写其父类的某个方法时,在重写方法的定义中,哪个部分可以与父类被重写方法的定义不同?
    A. 访问修饰符
    B. 方法名
    C. 返回值类型
    D. 方法形参

  8. 关于类中成员变量的作用范围,下述说法中正确的是( )。
    A. 只有用public修饰的变量才能在所有方法中使用
    B. 用private修饰的成员变量可以在main方法中直接使用
    C. 类中所有成员变量在所有成员方法中有效
    D. 用static修饰的成员变量只能在用static修饰的方法中使用

  9. 以下二维数组的定义正确的是( )
    A. int a[3][2]={{1,2},{1,3},{2,3}}
    B. int a[][]=new int[3][]
    C. int[][] a=new int[][3]
    D. int[][] a=new int[][]

  10. 以下哪句是错误的?
    A. 编译器会搜索要import的类的编译结果文件而不是源文件
    B. import是告诉编译器要import的包的信息
    C. import是把要import的类的源代码插入到import语句所在的地方
    D. 编译器在编译的时候需要能访问得到要import的类的编译结果文件

  11. 下面关于数组声明和初始化的语句那个有语法错误?( )
    A. int a1[]={3,4,5};
    B. String a2[]={“string1”,“string1”,“string1”};
    C. String a3[]=new String(3);
    D. int[][] a4=new int[3][3];

  12. 下面哪条语句可以将字符串s转换为double类型的值d?
    A. d = Double.parseDouble(s);
    B. d = (new Double(s)).doubleValue();
    C. d = Double.valueOf(s).doubleValue();
    D. 以上所有

  13. 下列选项中,用于定义接口的关键字是( )。
    A. interface
    B. implements
    C. abstract
    D. class

  14. 若A1、A2为已定义的接口 ,以下接口定义中没有语法错误的是( ) 。
    A. interface B { void print() { } }
    B. abstract interface B { void print() }
    C. abstract interface B extends A1,A2 { abstract void print(){ };}
    D. interface B { void print();}

  15. 给定以下代码,请问下列选项中哪个是正确的?

public interface Top{
  void twiddle(String s);
}
A. 
	public abstract class Sub implements Top{
  public abstract void twiddle(String s){ }
}
B. 
public class Sub implements Top{
  public void twiddle(Integer i){ }
}
C. 
public class Sub implements Top{
  void twiddle(String s){ }
}
D. 
public class Sub implements Top{
  public void twiddle(String s){ }
  public void twiddle(Integer i){ }
}
  1. 下面选项中能把字符串转换成float类型的是?( )
    A. float value = new Float(str);
    B. float value = Float.parseFloat(str);
    C. float value = Float.floatValue(str);
    D. float value = (new Float()).parseFloat(str)

  2. 在Java中用什么关键字修饰的方法可以直接通过类名来调用?( )
    A. static
    B. final
    C. private
    D. void

  3. 在使用interface声明一个接口时,只可以使用( )修饰符修饰该接口。
    A. private
    B. protected
    C. private protected
    D. public

  4. 给定下列代码,则下列选项中能够正确编译的是哪一个?

abstract class Shape{
  int x;
  int y;
  public abstract void draw();
}
A. 
abstract class Circle implements Shape{
  private int radius;
}
B. 
abstract class Circle extends Shape{
  private int radius;
}
C. 
class Circle extends Shape{
  private int radius;
  public void draw();
}
D. 
class Circle implements Shape{
  private int radius;
  public void draw();
}
  1. 下面代码的输出的结果是()。
class Person { 
	static String country="A城市" ; 
} 
public class Test {
	public static void main(String args[]) { 
		Person p1=new Person(); 
		Person p2=new Person(); 
		p1.country="B城市"; 
		p2.country="C城市"; 
		System.out.println(p1.country); 
		System.out.println(p2.country); 
	} 
}
A. B城市 C城市
B. B城市 B城市
C. A城市 C城市
D. C城市 C城市
  1. 下面哪个对类的声明是错误的?
    A. class MyClass extends MySuperClass1, MySupperClass2 {}
    B. public class MyClass{}
    C. abstract class MyClass implements YourInterface1, Youriterface2 {}
    D. private class MyClass {}
    E. class MyClass extends MySuperClass implements YourInterface {}

  2. Which of the following statement is true?
    A. The equals() method of any class determines if reference values refer to the same object.
    B. The == operator determines if the contents and type of two separate objects match.
    C. The equals() method of any class returns true only when the contents of two objects match.
    D. The class File overrides equals() to return true if the contents and type of two separate objects match.

  3. 为AB类的一个无形式参数无返回值的方法method书写方法头,使得使用类名AB作为前缀就可以调用它,该方法头的形式为( )。
    A. static void method( )
    B. public void method( )
    C. final void method( )
    D. abstract void method( )

  4. 关于接口,下面的叙述错误的是()。
    A. 一个接口可以多继承多个接口
    B. 一个类可以实现多个接口
    C. 抽象类在实现接口时,可以不实现该接口中声明的所有方法
    D. 抽象类在实现接口时,必须实现该接口中声明的所有方法

  5. 以下描述错误的有
    A. abstract 可以修饰类、接口、方法
    B. abstract修饰的类主要用于被继承
    C. abstract 可以修饰变量
    D. abstract修饰的类,其子类也可以是abstract修饰的

  6. Given code below:

class Value {
    int i;
}
public class Test {
    public static void main(String[] argv) {
        Integer v1 = 39;
        Integer v2 = 39;
        System.out.println(v1.equals(v2));
    }
}

Which of the following statement is true?
A. It does not compile because of line 6 and 7, that the type are not match for assignment operator.
B. It compiles and print out “true”.
C. It compiles and print out “false”.
D. It compiles but exception raises for line 6 at run time: type mismatch.

  1. Given code below, which statement is correct?
public class Person{
     static int arr[] = new int[5];
     public static void main(String a[]) {
          System.out.println(arr[0]);
     }}
A. Compile error.
B. Compiles but run-time error
C. Prints 0
D. Prints nothing
  1. 类的实例方法表示的是什么?( )
    A. 父类对象的行为
    B. 类的属性
    C. 类对象的行为
    D. 类的行为

  2. The output of the code below is:

public class Pass{
    static int j = 20;
    public void amethod(int x){
         x = x*2;
         j = j*2;
    }
    public static void main(String args[]) {
        int i = 10;
        Pass p = new Pass();
        p.amethod(i);
        System.out.println(i+" and "+j);
  }}
A. Compile error
B. 20 and 40
C. 10 and 40
D. 10 and 20
  1. 下列关于抽象类的说法哪一个是错误的。
    A. 含抽象方法的类为抽象类
    B. 抽象类能创建(new)实例
    C. 子类有未实现父类的抽象方法时仍为抽象类
    D. 子类实现所有抽象方法时不再是抽象类

  2. 以下对抽象类的描述正确的是
    A. 抽象类没有构造方法
    B. 抽象类必须提供抽象方法
    C. 有抽象方法的类一定是抽象类
    D. 抽象类可以通过new关键字直接实例化

  3. 若在某一个类定义中定义有如下的方法:abstract void performDial( );该方法属于( )。
    A. 接口方法
    B. 最终方法
    C. 抽象方法
    D. 空方法

  4. 分析如下代码。

public class Test {
  public static void main(String[] args) {
    double radius;
    final double PI= 3.15169;
    double area = radius * radius * PI;
    System.out.println("Area is " + area);
  }
}

如下说法哪句是正确的?
A. 程序编译错误,因为变量radius没有初始化。
B. 程序编译错误,因为常量PI定义在方法中。
C. 程序没有编译错误但运行时会出错,因为radius没有初始化。
D. 程序编译和运行正确。

  1. Given code below:
class A {
    private int m;
    public int k;
    static int g;
    int h;
    static void f() {}
}

Which variable is accessible in function f?
A. m
B. k
C. g
D. h

  1. 下列选项中,用于实现接口的关键字是 ( )。
    A. interface
    B. implements
    C. abstract
    D. class

  2. 关于以下程序代码的说明正确的是( ) 。

1class  HasStatic{
2private  static  int  x=1003public  static  void  main(String[  ]  args){
4HasStatic  hs1=new  HasStatic(  );
5.        hs1.x++;
6HasStatic  hs2=new  HasStatic(  );
7.        hs2.x++;
8.        hs1=new  HasStatic( );
9.        hs1.x++;
10HasStatic.x--;
11System.out.println(“x=+x);
12}
13}
A. 5行不能通过编译,因为引用了私有静态变量
B. 10行不能通过编译,因为x是私有静态变量
C. 程序通过编译,输出结果为:x=103
D. 程序通过编译,输出结果为:x=102
  1. 关于接口的声明,错误的是( ) 。
    A. 接口中所有的成员属性都是public static final修订的常量
    B. 接口中的成员属性在声明时可以省略修订关键字
    C. 接口中所有的方法都是public abstract final修订的
    D. 接口中所有的方法都是public abstract修订的

  2. 关于抽象类,下面叙述错误的是() 。
    A. 包含抽象方法的类必须是抽象类
    B. 抽象方法只需要声明,不需要实现
    C. 抽象类可以实例化
    D. 抽象类中可以没有抽象方法

  3. 在Java中,能实现多重继承效果的方式是( )。
    A. 接口
    B. 继承
    C. 内部类
    D. 适配器

  4. 欲构造ArrayList类的一个实例,此类继承了List接口,下列哪个方法是正确的?( )
    A. ArrayList myList=new Object();
    B. List myList=new ArrayList();
    C. ArrayList myList=new List();
    D. List myList=new List();

  5. 编译和运行下列程序会出现什么样的结果( )。

public class Ref {
       public static void main(String[] args){
             Ref r = new Ref();
             r.amethod(r);
       }
       public void amethod(Ref r){
             int i = 99;
             multi(r);
       System.out.println(i);
       }
       public void multi(Ref r){
             r.i = r.i * 2;
       }
}
A. 编译出错
B. 输出:99
C. 输出:198
D. 运行出错
  1. 当编译运行下列代码时,运行结果是什么?
public class Main{
  int arr[]=new int[10];
  public static void main(String args[]){
     System.out.println(arr[1]);
  }
}
A. 编译错误
B. 编译正确,但运行时出现异常
C. 输出0
D. 输出null
  1. 若需要定义一个类属性或类方法,应使用哪种修饰符?( )
    A. static
    B. package
    C. private
    D. public

  2. For the code below:

class Test {
    private int m;
    public static void fun(  ) {
        // some code…
    }
}

How to make the member variable m be visited by the function fun()?
A. Change private int m to protected int m
B. Change private int m to public int m
C. Change private int m to static int m
D. Change private int m to int m

  1. 假设类A有如下定义,且a是A类的一个实例,则必定错误的选项是( )。
class  A {
      int  i;
      static  String  s;
       void  method1() {   }
       static  void  method2()  {   }
}
A. System.out.println(a.i);
B. a.method1();
C. A.method1();
D. A.method2() ;
  1. Given a public member variable MAX_LENGTH as the int type is a constant of 100, the correct statement to define the variable is:
    A. public int MAX_LENGTH=100
    B. final int MAX_LENGTH=100
    C. public const int MAX_LENGTH=100
    D. public final int MAX_LENGTH=100

  2. 下列哪个类的声明是正确的?( )
    A. abstract final class HI{}
    B. abstract private move(){}
    C. protected private number;
    D. public abstract class Car{}

  3. getCustomerInfo()方法如下,try中可以捕获三种类型的异常,如果在该方法运行中产生了一个IOException,将会输出什么结果( )。

public void getCustomerInfo() {
            try {
              // do something that may cause an Exception
            } catch (java.io.FileNotFoundException  ex){
                  System.out.print("FileNotFoundException!");
            } catch (java.io.IOException  ex){
                System.out.print("IOException!");
            } catch (java.lang.Exception  ex){
                 System.out.print("Exception!");
            }
}
A. IOException!
B. IOException!Exception!
C. FileNotFoundException!IOException!
D. FileNotFoundException!IOException!Exception!
  1. 以下描述不正确的有
    A. try块不可以省略
    B. 可以使用多重catch块
    C. finally块可以省略
    D. catch块和finally块可以同时省略

  2. 已知方法test()定义如下,在方法unsafe()运行正常的情况下哪条语句将肯定不会被输出?

public void test( ){
try {
   unsafe();
   System.out.println("Test 4");
} catch(SafeException e) {
   System.out.println("Test 3");
}finally{
   System.out.println("Test 2"); 
}
   System.out.println("Test 1"); 
}
A. Test 4
B. Test 3
C. Test 2
D. Test 1
  1. 假设方法unsafe() 将抛出IOException, 可以填入如下代码段第1行的选项是( )。
1)
2) { if(unsafe()){//do something…}
3)   else if(safe()){//do the other…}
4) }
A. public IOException methodName()
B. public void methodName()
C. public void methodName() throw IOException
D. public void methodName() throws IOException
  1. 给定一个未完成的方法 ,代码如下:
//此处添加方法的声明
{
   int success=connect();
   if(success==-1)
      throw new TimedOutException();
}

已知TimedOutException不属于RuntimeException,那么在第一行注释位置上填写哪段代码能够正确完成该方法的声明?
A. public void MyMethod()
B. public void MyMethod() throws TimedOutException
C. public void MyMethod() throw TimeOutException
D. public throws TimedOutException void MyMethod()

  1. 已知下列代码,如果方法oneMethod()运行异常,则下列哪个语句肯定不会被输出?
public void example(){
   try {
   oneMethod();
   System.out.println("condition1");
}catch(ArrayIndexOutOfBoundsException e) {
   System.out.println("condition2");
}catch(Exception e) {
   System.out.println("condition3");
}finally{
   System.out.println("condition4"); 
}
A. condition1
B. condition2
C. condition3
D. condition4
  1. 下面代码运行结果是
public class Demo{
    public int add(int a,int b){
        try{
            return a+b;
        }catch(Exception e){
            System.out.println(catch 语句块”);
        }finally{
            System.out.println(finally 语句块”);
        }
        return 0;
    }
    public static void main(String[] args){
        Demo demo = new Demo();
        System.out.println(“和是:”+demo.add(9,34));
    }
}
A. 编译异常
B. finally语句块 和是:43
C. 和是:43 finally语句块
D. catch语句块 和是:43
  1. 下列哪种异常是检查型异常,需要在编写程序时声明 ( ).
    A. NullPointerException
    B. ClassCastException
    C. FileNotFoundException
    D. IndexOutOfBoundsException

  2. 以下程序运行结果是

public class Test {
    public int div(int a, int b) {
        try {
            return a / b;
        }catch(Exception e){
            System.out.println(Exception);
        }catch(NullPointerException e){
            System.out.println(ArithmeticException);
        }
        catch (ArithmeticException e) {
            System.out.println(ArithmeticException);
        } finally {
            System.out.println(finally);
        }
        return 0;
    }
    public static void main(String[] args) {
        Test demo = new Test();
        System.out.println(“商是:” + demo.div(9, 0));
    }
}
A. Exception finally 商是:0
B. ArithmeticException finally 商是:0
C. finally商是:0
D. 编译报错
  1. For code below, the result would be?
    String s = "Welcome to Zhejiang University";
    String[] a = s.split(" ");
    System.out.println(a.length);
A. 4
B. 3
C. Compile error
D. Run-time exception
  1. 下列哪个选项可以计算出角度为42度的余弦值?
    A. double d=Math.cos(42);
    B. double d=Math.conine(42);
    C. double d=Math.cos(Math.toRadians(42));
    D. double d=Math.cos(Math.toDegrees(42));

  2. Which class is considered immutable? 分值为2分。
    A. Integer
    B. Double
    C. Char
    D. String。

  3. 如下程序输出( )

public class Test {  
  public static void main(String[] args) {
    String s = "Java";
    StringBuilder buffer = new StringBuilder(s);
    change(s);
    System.out.println(s);
  }

  private static void change(String s) {
    s = s + " and HTML";
  }
}
A. Java
B. Java and HTML
C. and HTML
D. 什么都不显示
  1. What will be output by the following line?
    System.out.println(Math.floor(-2.1));
    A. -2
    B. 2.0
    C. -3
    D. -3.0

  2. The result of code below is:

public class Test {
     public static void main(String args[]){
          String str="ABCDE";
          str.substring(3);
          str.concat("XYZ");
          System.out.print(str);
}}
A. DE
B. DEXYZ
C. ABCDE
D. CDEXYZ
  1. Which expression below is for generating a random number of [20,999]?
    A. (int)(20+Math.random()*979)
    B. 20+(int)(Math.random()*980)
    C. (int)Math.random()*999
    D. 20+(int)Math.random()*980

  2. 如下代码输出( )。

public class Test {  
  public static void main(String[] args) {
    String s = "Java";
    StringBuilder buffer = new StringBuilder(s);
    change(buffer);
    System.out.println(buffer);
  }

  private static void change(StringBuilder buffer) {
    buffer.append(" and HTML");
  }
}
A. Java
B. Java and HTML
C. and HTML
D. 什么都不显示
  1. The result of Math.abs(10.4) is:
    A. 10.4
    B. 10
    C. 10.0
    D. -10.4

  2. Which of the following will output -3.0
    A. System.out.println(Math.floor(-3.7));
    B. System.out.println(Math.round(-3.7));
    C. System.out.println(Math.ceil(-3.7));
    D. System.out.println(Math.min(-3.7));

  3. 请选择下面程序正确的输出结果( )

public class Main{
        public static void main(String args[ ]){
            String a = new String("A");
            String b = new String("B");
            mb_operate(a,b);
            System.out.println(a + "." + b);
}
static void mb_operate(String x,String y){
    x.concat(y);
    y=x;
}
}
A. A.B
B. A.A
C. AB.AB
D. AB.B
  1. What is the value of s2 after this code executes? String s1 = “Happy day”; String s2 = s1.substring(1,5); ,分值为2分。
    A. “Happ”
    B. “Happy”
    C. “appy”
    D. "appy "

  2. 下列哪行代码将输出整数7?

1: public class Main{
2:    public static void main(String args[]){
3:      double x=6.5;
4:      System.out.println(Math.floor(x+1));
5:      System.out.println(Math.ceil(x));
6:      System.out.println(Math.round(x));
7:    }
8: }
A. 第4行
B. 第4行和第5行
C. 第6行
D. 第4、5、6行
  1. To make method( -4.4 ) == -4 successful, which method of java.lang.Math should be used?
    A. round()
    B. min()
    C. trunc()
    D. abs()

  2. What is the result of executing the following code: ( )

public class Test{ 
	public static void main(String args[]) { 
		String word = "restructure"; 
		System.out.println(word.substring(2, 5)); 
	} 
}
A. rest
B. es
C. str
D. st
  1. For code below, the result would be?
String s = "  Welcome to Zhejiang University  ";
s.trim();
System.out.println(s.startsWith("Welcome"));
A. true
B. false
C. Compile error
D. Run-time exception
  1. 以下代码输出( )。
    public static void main(String[] args) {
    
    String[] tokens = "Welcome to Java".split("o");
    for (int i = 0; i < tokens.length; i++) {
      System.out.print(tokens[i] + " ");
    }
  }
A. Welcome to Java
B. Welc me to Java
C. Welc me t  Java
D. Welcome t  Java
  1. 以下代码段将创建几个对象?
String s1="bc";
String s2="bc";
A. 2
B. 3
C. 0
D. 1
  1. The result of Math.floor(-10.4) is:
    A. 10.4
    B. -10.0
    C. -11.0
    D. -10.4

  2. Which correctly create an array of five empty Strings? ( )
    A. String a [] = {“”, “”, “”, “”, “”, “”};
    B. String a [5];
    C. String [5] a;
    D. String [] a = new String[5]; for (int i = 0; i < 5; a[i++] = null);

  3. 如果你被要求写一段代码读取一个文本文件,那么一般使用哪种Stream?
    A. DataInputStream
    B. ObjectInputStream
    C. FileReader
    D. FileInputStream

  4. transient 变量和下面哪一项有关?
    A. Cloneable
    B. Serializable
    C. Runnable
    D. Throwable
    E. Comparable

  5. 下列哪条语句可以正确创建出一个BufferedReader的数据流( )。
    A. new BufferedReader(new FileReader(“myFile.txt”));
    B. new BufferedReader (new FileInputStream(“myFile.txt”));
    C. new BufferedReader (new DataInputStream(“myFile.txt”));
    D. new BufferedReader (“myFile.txt”);

  6. 在Java中,以下代码( )正确地创建了一个InputStreamReader对象。
    A. InuptStreamReader(new FileReader(“1.dat”));
    B. InuptStreamReader(new FileInputStream(“1.dat”));
    C. InuptStreamReader(new BufferReader(“1.dat”));
    D. InuptStreamReader (“1.dat”);

  7. 要创建一个新目录,可以用下面( )类实现。
    A. FileInputStream
    B. FileOutputStream
    C. RandomAccessFile
    D. File

  8. 阅读Shape和Circle两个类的定义。在序列化一个Circle的对象circle到文件时,下面哪个字段会被保存到文件中? ( )

class Shape {
           public String name;
}
class Circle extends Shape implements Serializable{
        private float radius;
        transient int color;
       public static String type = "Circle";
}
A. name
B. radius
C. color
D. type
  1. 下面哪个流类属于面向字符的输入流( ) 。
    A. BufferedWriter
    B. FileInputStream
    C. ObjectInputStream
    D. InputStreamReader

  2. 如果需要从文件中读取数据,则可以在程序中创建哪一个类的对象()。
    A. FileInputStream
    B. FileOutputStream
    C. DataOutputStream
    D. FileWriter

  3. 在Java中,( )类提供定位本地文件系统,对文件或目录及其属性进行基本操作。。
    A. FileInputStream
    B. FileReader
    C. File
    D. FileWriter

  4. 下列方法中可以用来创建一个新线程的是( )。
    A. 实现java.lang.Runnable接口并重写start()方法
    B. 实现java.lang.Runnable接口并重写run()方法
    C. 实现java.lang.Thread类并重写run()方法
    D. 实现java.lang.Thread类并重写start()方法

  5. 下列关于线程优先级的说法中,正确的是( )。
    A. 线程的优先级是不能改变的
    B. 线程的优先级是在创建线程时设置的
    C. 在创建线程后的任何时候都可以设置线程优先级
    D. B和C

  6. 一个线程在任何时刻都处于某种线程状态(thread state),例如运行状态、阻塞状态、就绪状态等。一个线程可以由选项中的哪种线程状态直接到达运行状态?( )
    A. 死亡状态
    B. 阻塞状态(对象lock池内)
    C. 阻塞状态(对象wait池内)
    D. 就绪状态

  7. 下面关于Java中线程的说法不正确的是( )。
    A. 调用join()方法可能抛出异常InterruptedException
    B. sleep()方法是Thread类的静态方法
    C. 调用Thread类的sleep()方法可终止一个线程对象
    D. 线程启动后执行的代码放在其run方法中

  8. 下列哪个叙述是正确的?
    A. 多线程需要多个CPU才可以。
    B. 多线程需要多个进程来实现。
    C. 一个进程可以产生多线程。
    D. 线程之间无法实现数据共享。

  9. 有关线程的哪些叙述是对的?
    A. 一旦一个线程被创建,它就立即开始运行。
    B. 当一个线程因为抢先机制而停止运行,它被放在可运行队列的前面。
    C. 一个线程可能因为不同的原因停止(cease)并进入就绪状态。
    D. 使用start()方法可以使一个线程成为可运行的,但是它不一定立即开始运行。

  10. 下列说法中错误的一项是( )。
    A. 线程就是程序
    B. 线程是一个程序的单个执行流
    C. 多线程是指一个程序的多个执行流
    D. 多线程用于实现并发

  11. 下列哪个情况可以终止当前线程的运行?( )
    A. 抛出一个异常时
    B. 当该线程调用sleep()方法时
    C. 当创建一个新线程时
    D. 当一个优先级高的线程进入就绪状态时

  12. 线程通过( )方法可以使具有相同优先级线程获得处理器。
    A. run( )
    B. setPriority( )
    C. yield( )
    D. sleep( )

  13. 在下面程序中的括号中,如下哪些代码可以创建并启动线程?( )\n```java public class MyRunnable implements Runnable { public void run() { ( ) } }
    A. new Runnable(MyRunnable).start();
    B. new Thread(MyRunnable).run();
    C. new Thread(new MyRunnable()).start();
    D. new MyRunnable().start();

  14. 用( )方法可以改变线程的优先级。
    A. run()
    B. setPrority()
    C. yield()
    D. sleep()

  15. Runnable接口定义了如下哪个方法?( )。
    A. start( )
    B. stop( )
    C. sleep( )
    D. run( )

  16. 以下哪个方法用于定义线程的执行体? ( )
    A. start()
    B. init()
    C. run()
    D. ynchronized()

  17. 下面说法正确的是( ) 。
    A. JAVA中线程是非抢占式的
    B. JAVA中的线程不可以共享数据
    C. 每个JAVA程序都至少有一个线程,即主线程
    D. JAVA中的线程不可以共享代码

进程已结束,退出代码0

  • 0
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

摘星喵Pro

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值