首 页 | 精品电影 | 音乐天堂 | 在线游戏 | Flash MTV | 三湘书屋 | 幽默笑话 | 三湘图库 | 美女写真 | IT知识库 | QQ贴图 | 加入书签

网页制作网络编程图形图象操作系统冲浪宝典软件教学网络安全认证考试通信技术电子商务业内动态书籍教程原码

最近更新 文章分类 多媒体类 精品软件

本站搜索:
您的位置:三湘时空 -> IT知识库 -> 文章分类 -> 其它编程 -> Test of the Java Skill(3)
Test of the Java Skill(3)


文章类别:其它编程 来源: 作者: 发表日期:2006-4-10 字体:[ ]

小游戏 | 在线影院 | 幽默笑话 | 源码下载 | Flash MTV | 音乐试听 | 书屋 | 美女写真

Question 17:
   What will happen when you attempt to compile and run this code?
   class Base{
   abstract public void myfunc();
   public void another(){
   System.out.println(“Another method”);
   }
   }

   public class Abs extends Base{
   public static void main(String argv[]){
   Abs a = new Abs();
   a.amethod();
   }
   public void myfunc(){
   System.out.println(“My func”);
   }
   public void amethod(){
   myfunc();
   }
   }

   A. The code will compile and run, printing out the words “My func”

   B. The compiler will complain that the Base class is not declared as abstract.

   C. The code will compile but complain at run time that the Base class has non abstract methods

   D. The compiler will complain that the method myfunc in the base class has no body

   Question 18:
   You need to create a class that will store some unique object elements. You do not need to sort these elements but they must be unique.

   What interface might be most suitable to meet this need?

   A. Set

   B. List

   C. Map

   D. Vector

   Question 19:
   What will happen when you attempt to compile and run the following code?

   class Background implements Runnable{
   int i = 0;
   public int run(){
   while(true){
   i++;
   System.out.println(“i=” + i);
   }//End while
   }//End run
   }//End class

   A. It will compile and the run method will print out the increasing value of i

   B. It will compile and calling start will print out the increasing value of i

   C. The code will cause an error at compile time

   D. Compilation will cause an error because while cannot take a parameter of true

   Question 20:
   Given the following code how could you invoke the Base constructor that will print out the string “base constructor”?
   class Base{
   Base (int i){
   System.out.println(“base constructor”);
   }
   Base(){
   }
   }

   public class Sup extends Base{
   public static void main(String argv[]){
   Sup s = new Sup();
   // One
   }
   Sup(){
   // Tow
   }
   public void derived(){
   // Three
   }
   }

   A. On the line After // One put Base(10);

   B. On the line After // One put super(10);

   C. On the line After // Two put super(10);

   D. On the line After // Three put super(10);

   Question 21:
   Why might you define a method as native?
   A. To get to access hardware that Java does not know about

   B. To define a new data type such as an unsigned integer

   C. To write optimized code for performance in a language such as C/C++

   D. To overcome the limitation of the private scope of a method

   Question 22:
   What will happen when you attempt to compile and run the following code with the command line “hello there”?

   public class Arg{
   String[] MyArg;
   public static void main(String argv[]){
   MyArg = argv;
   }
   public void amethod(){
   System.out.println(argv[1]);
   }
   }

   A. Compile time error

   B. Compilation and output of “hello”

   C. Compilation and output of “there”

   D. None of the above

   Question 23:
   What will be printed out if this code is run with the following command line?
   java myprog good morning

   public class myporg{ 
   public static void main(String argv[]){
   System.out.println(argv[2]);
   }
   }

   A. myprog

   B. good

   C. morning

   D. Exception raised: “java.lang.ArrayIndexOutOfBoundsException: 2”

   Question 24:
   What will happen when you attempt to compile and run the following code?

   public class Hope{
   public static void main(String argv[]){
   Hope h = new Hope();
   }

   protected Hope(){
   for (int i=0; i<10; i++){
   System.out.println(i);
   }
   }
   }

   A. Compilation error: Constructors cannot be declared protected

   B. Run time error: Constructors cannot be declared protected

   C. Compilation and running with output 0 to 10

   D. Compilation and running with output 0 to 9(CN-JAVA)

上一篇:请保持你对Java的敏感度:了其然,知其用 下一篇:SCJP认证套题解析之五
本栏目热门文章
·Discuz!论坛安装步骤图文详解 2006-5-22
·X-Space详细图文安装及常见错误解决 2006-5-22
·得心应手 X-Space下的二级域名配置 2006-5-22
·Discuz! 4.1.0 IIS Rewrite设置方法 2006-5-22
·轻松简单 X-Spacee与Discuz!论坛整合详解 2006-5-22
·Perl文件及目录操作 2006-3-6
·Shell介绍 2006-3-6
·站长手记:Discuz!4.1多论坛数据合并实战 2006-5-22
·在Authorware中控制Flash动画 2006-4-10
·Perl简单模块指南 2006-3-6
新近更新文章
·X-Space最吸引网民的八大特色 2006-6-20
·手把手学习X-Space模块设置 打造个性个人门户网站 2006-6-15
·从动网DV7.1Access转换到Discuz4.1 2006-6-15
·Windows版本Discuz!—EasyDiscuz!安装介绍 2006-6-9
·Discuz! 4.10论坛“傻瓜式”安装教程 2006-6-4
·站长网友最满意的6大X-Space功能 2006-5-28
·X-Space技巧:如何在个人博客设置音乐播放 2006-5-28
·来!把我的Blog数据转移到X-Space里 2006-5-22
·X-Space详细图文安装及常见错误解决 2006-5-22
·得心应手 X-Space下的二级域名配置 2006-5-22
首 页 | 软件发布 | 广告联系 | 下载帮助 | 意见反馈 | 网站地图
  CopyRight? 2002-2004 WWW.SXSKY.NET? All Rights Reserved
三湘时空 站长QQ:82675303 Email: