Test of the Java Skill(4)

2016-02-19 18:39 1 1 收藏

岁数大了,QQ也不闪了,微信也不响了,电话也不来了,但是图老师依旧坚持为大家推荐最精彩的内容,下面为大家精心准备的Test of the Java Skill(4),希望大家看完后能赶快学习起来。

【 tulaoshi.com - 编程语言 】


     Question 25:
     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 perform 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”
  
     Question 26:
     Which of the following are true?
  
     A. Java uses a time-slicing scheduling system for determining which Thread will execute.
  
     B. Java uses a pre-emptive, co-operative system for determining which Thread will execute.
  
     C. Java scheduling is platform dependent and may vary from one implementation to another.
  
     D. You can set the priority of a Thread in code.
    Question 27:
     What will happen when you attempt to compile and run the following code?
  
     public class MySwitch{
     public static void main(String argv[]){
     MySwitch ms = new MySwitch();
     ms.amethod();
     }
     public void amethod(){
     int k=10;
     switch(k){
     default:
     System.out.println(“This is the default output”);
     break;
     case 10:
     System.out.println(“ten”);
     case 20:
     System.out.println(“twenty”);
     break;
     }
     }
     }
  
     A. None of these options
  
     B. Compile time error target of switch must be an integral type
  
     C. Compile and run with output “This is the default output”
  
     D. Compile and run with output “ten”
  
     Question 28:
     What will happen when you attempt to compile and run the following code?
     public class StrEq{
     public static void main(String argv[]){
     StrEq s = new StrEq();
     }
     private StrEq(){
     String s = “Marcus”;
     String s2 = new String(“Marcus”);
     if (s==s2){
     System.out.println(“we have a match”);
     }else{
     System.out.println(“Not equal”);
     }
     }
     }
  
     A. Compile time error caused by private constrUCtor
  
     B. Output of “we have a match”
  
     C. Output of “Not equal”
  
     D. Compile time error by attempting to compare string using ==
  

来源:https://www.tulaoshi.com/n/20160219/1618508.html

延伸阅读
上一节: 跟我学Java Swing之游戏设计(3) !-- frame contents -- !-- /frame contents -- 你有没有经历过装修?尽管它是件劳神费力的事,可现代人还是不遗余力地在装修上花尽心思。究竟,在这个视觉支配感观的时代里,谁会嫌自己家太漂亮呢?今天,就让我们秉着精益求精的完美主义精神,在上次已经完成的游戏界面里再做...
1. Java中的访问控制 表1-1 可见/访问性 public protected package private 在同一类中 yes yes yes Yes 同一包中 yes yes yes no 不同包中 yes No No No 同一包的子类中 yes yes ...
标签: 电脑入门
Linux系统中有时需要检测某个条件是否成立,那么就要用到test命令了,Linux下test的用法有很多,下面就随图老师小编一起来学习下Linux系统中如何使用test命令吧。 1.判断一个命令的结果使用test,其返回0,或一个整数。返回0表示true,返回整数表示错误码 2.获取上一个命令的返回结果使用$? 3.例如 我的服务器上面存在/home/www...
标签: Web开发
javascript 中的 RegExp 对象用于正则表达式相关的操作,这个对象提供了一个方法 test 来判定某个字符串是否满足某个 pattern. 返回值是 true/false. 今天我碰到了一个问题: script type="text/javascript" !-- var re = /^d+(?:.d)?$/ig;    alert(re.test('112.3')); alert(re.test('33')); /...
  Java语言恐怕是稳居网路应用程序语言的首选了,这都要归功于它高度的安全性以及跨平台的特性,几乎在目前所有的电脑平台上您都可以见得到Java的芳踪. JDK是整个Java的核心,包括了Java运行环境(Java Runtime Envirnment),一堆Java工具和Java基础的类库(rt.jar).不论什么Java应用服务器实质都是内置了某个版本的JDK.Java SE 6,历经了Sun 330...

经验教程

50

收藏

68
微博分享 QQ分享 QQ空间 手机页面 收藏网站 回到头部