Java知识分享网 - 轻松学习从此开始!    

Java知识分享网

Java1234官方群25:java1234官方群17
Java1234官方群25:838462530
        
SpringBoot+SpringSecurity+Vue+ElementPlus权限系统实战课程 震撼发布        

最新Java全栈就业实战课程(免费)

springcloud分布式电商秒杀实战课程

IDEA永久激活

66套java实战课程无套路领取

锋哥开始收Java学员啦!

Python学习路线图

锋哥开始收Java学员啦!

Java选择题40道全英文带答案 PDF 下载


分享到:
时间:2020-04-28 15:51来源:http://www.java1234.com 作者:小锋  侵权举报
Java选择题40道全英文带答案 PDF 下载
失效链接处理
Java选择题40道全英文带答案 PDF  下载

本站整理下载:
 
相关截图:
 
主要内容:

1、 Read the following program:
 
public class test {
public static void main(String [] args) {
          int x = 3;
          int y = 1;
          if (x = y)
           System.out.println("Not equal");
         else
          System.out.println("Equal");
 }
}
 
What is the result?
A.The output is equal    
B. The output in not Equal   
C. An error at " if (x = y)" causes compilation to fall      
D. The program executes but no output is show on console.
Answer: C
 
2、Which of the following lines will compile without warning or error.  
A .float f=1.3; 
B.char c="a";  
C.byte b=257;  
D.int i=10; 
Answer:D 
 
3、What will happen if you try to compile and run the following code 
   public class MyClass {      
public static void main(String arguments[]) {   
amethod(arguments);     
}      
public void amethod(String[] arguments) {  
System.out.println(arguments);   
System.out.println(arguments[1]);     
} 
}  
A.error Can't make static reference to void amethod.  
B. error method main not correct  
C. error array must include parameter  
D.amethod must be declared with String
Answer:A
 
4、Which of the following will compile without error 
A.import java.awt.*; 
   package Mypackage; 
   class Myclass {} 
B.package MyPackage; 
   import java.awt.*; 
   class MyClass{}  
C.package MyPackage; 
   import java.awt.*; 
   class MyClass{}
Answer:C
 
5、A byte can be of what size    
A. -128 to 127   
B. (-2 power 8 )-1 to 2 power 8  
C. -255 to 256   
D.depends on the particular implementation of the Java Virtual machine 
Answer:A
 
6、What will be printed out if this code is run with the following command line?    public class myprog{      
public static void main(String argv[])     {  
System.out.println(argv[2]);   
  } 
}   
A. myprog  
B. good  
C. morning   
D. Exception raised: "java.lang.ArrayIndexOutOfBoundsException: 2"  
Answer:D
 
7、What will happen when you compile and run the following code?      
public class MyClass{  
static int i;   
public static void main(String argv[]){  
System.out.println(i); 
 } 
} 
A. Error Variable i may not have been initialized  
B. null  
C. 1  
D. 0
Answer:D
 
8、Which of the following lines will compile without warning or error.  
A .float f=1.3; 
B.char c="a";  
C.byte b=257;  
D.int i=10;  
Answer:D
 
9、What will happen if you try to compile and run the following code?
   Public class Q{
    Public static void main(String arg[]){
Int anar[] = new int[5];
System.out.println(anar[0]);
}
   }
A.Error:anar is referenced before itt is initialized
B.Null
C.0
D.5
 

------分隔线----------------------------

锋哥公众号


锋哥微信


关注公众号
【Java资料站】
回复 666
获取 
66套java
从菜鸡到大神
项目实战课程

锋哥推荐