About JIT JVM, which statement below is correct?【B】
A.The compiler generates native code, so JIT runs faster.
B.The JVM will translate byte code into native code at class loading.
C.The JVM will compile source code into native code at class loading.
D.Only JNI code runs faster in JIT JVM.
About JIT JVM, which statement below is correct?【C】
A.The compiler generates native code for JIT JVM.
B.There is a special translator to convert byte code into native code before its loading into the JVM.
C.It is the JVM that translates the byte code into native during the loading of the class.
D.Java Native Invoking is the way JIT JVM does to make program run faster.
Which statements about the garbage collection are true?【B】
A.The program developer must create a thread to be responsible for free the memory.
B.The garbage collection will check for and free memory no longer needed.
C.The garbage collection allows the program developer to explicitly and immediately free the memory.
D.The garbage collection can free the memory used by Java object at expect time.
选项()不是Java语言的特点。【D】
A.面向对象
B.可移植
C.解释型
D.可访问物理内存
关于Java语言的描述,错误的是()。【A】
A.每一个.java文件编译后对应一个.class文件。
B. .java文件编译后,每一个class对应一个.class文件
C.Java源代码编译后产生的.class是字节码文件
D. .class文件在JVM上运行
在windows平台上安装配置JDK时,下列的说法错误的是_____。【C】
A.设置path的作用是指定命令搜索路径
B.设置CLASSPATH的作用是指定类搜索路径
C.javac的功能是编译并执行 java代码项
D.假设JDK的安装位置是:c:\java,那么应在path中加入下面的数据项:c:\java\bin
一个计算机上安装JDK后,该计算机不包含的是()。【C】
A.JRE
B.JVM
C.Eclipse
D.javac.exe
整型数据类型中,需要内存空间最少的是( ).【D】
A.short
B.long
C.int
D.byte
Which statement below is correct?【A】
A.int is always 32-bit on different platforms
B.int is 32-bit on 32-bit and smaller platforms, but 64-bit on 64-bit machines
C.int varies from platform to platform
D.int is always 64-bit on different platforms
Which statement below is incorrect:【A】
A.float a = 2.0
B.double b=2.0
C.int c=2
D.long d=2
Which word below is NOT keyword of Java? ( )【B】
A.const
B.NULL
C.false
D.native
Which line below will not generate warning or error when compiling? ( )【D】
A.float f = 1.3;
B.char c = “a”;
C.byte b = 257;
D.int i = 10;
Which is the value of temp after the code’s execution? ( )【B】
long temp = (int)3.9;
temp %= 2;
A.0
B.1
C.2
D.3
About Java, which statement below is NOT correct?【A】
A.The size of int type varies from platform to platform.
B.The size of int type is always 4 bytes among all the platforms.
C.The size of char type is Unicode coded.
D.A value of char type can be transformed to a value of int.
About the Java language, which statement below is NOT correct?【C】
A.A variable of byte type occupies one byte
B.A class can implement more than one interface
C.A class can inherit from more than one super class
D.All arrays are to be created dynamically.
About Java, which statement below is NOT correct?【C】
A.Big-endian is used to store all multi-byte data types.
B.The size of int type is always 4 bytes among all the platforms.
C.The char type is UTF-8 coded.
D.A value of char type can be transformed to a value of int.
Given:
Integer.valueOf(1).equals(Long.valueOf(1))
which statement below is right?【C】
A.It doesn’t compile.
B.The value is true.
C.The value is false.
D.It throws exception in run-time.
对下列代码执行结果的描述,错误的是()。【A】
A.int x=3,y=5; System.out.println(x/y); 的执行结果是:0.6
B.int x=3,y=5; System.out.println(x/y); 的执行结果是:0
C.int x=3; float y=5.0f; System.out.println(x/y); 的执行结果是:0.6
D.int x=3; float y=5.0f; System.out.println((int)(x/y)); 的执行结果是:0
已知int类型数据的范围是 -2147483648 ~ 2147483647 , 下列代码执行后的结果是()。【D】
int max=Integer.MAX_VALUE;
System.out.println(max+1);
A.Unknown
B.0
C.2147483647
D.-2147483648
import java.util.Scanner;
public class Main {public static void main(String[] args) {
// Scanner s = new Scanner(System.in);System.out.println("Hello World");}
}
|a|>1000
,否则输出a+b
的值。18 -299
1001 -9
-1001 8
输出样例:
-281
|a|>1000
|a|>1000
源代码:
import java.util.Scanner;
public class Main{public static void main(String[] args){Scanner s = new Scanner(System.in);int a,b;a=s.nextInt();b=s.nextInt();while(true){
// if(a>1000||a<-1000){
// System.out.println("|a|>1000");
// }if(Math.abs(a)>1000){//两种方法System.out.println("|a|>1000");}else {System.out.println(a+b);}a=s.nextInt();b=s.nextInt();}}
}