JAVA题库:格林模拟试题二(上)(4)

来源:java认证发布时间:2012-11-12 12:47:55java认证视频

 

question 10)

you want to find out the value of the last element of an array. you write the following code. what will happen when you compile and run it.?

public class myar{
public static void main(string argv[]){
int[] i = new int[5];
system.out.println(i[5]);
}
}

1) an error at compile time
2) an error at run time
3) the value 0 will be output
4) the string "null" will be output


question 11)

you want to loop through an array and stop when you come to the last element. being a good java programmer and forgetting everything you ever knew about c/c++ you know that arrays contain information about their size. which of the following can you use?

1)myarray.length();
2)myarray.length;
3)myarray.size
4)myarray.size();


question 12)

what best describes the appearance of an application with the following code?

import java.awt.*;
public class flowap extends frame{
public static void main(string argv[]){
    flowap fa=new flowap();
    fa.setsize(400,300);
    fa.setvisible(true);

}

flowap(){
        add(new button("one"));
        add(new button("two"));
        add(new button("three"));
        add(new button("four"));
    }//end of constructor



}//end of application

1) a frame with buttons marked one to four placed on each edge.
2) a frame with buutons marked one to four running from the top to bottom
3) a frame with one large button marked four in the centre
4) an error at run time indicating you have not set a layoutmanager

视频学习

我考网版权与免责声明

① 凡本网注明稿件来源为"原创"的所有文字、图片和音视频稿件,版权均属本网所有。任何媒体、网站或个人转载、链接转贴或以其他方式复制发表时必须注明"稿件来源:我考网",违者本网将依法追究责任;

② 本网部分稿件来源于网络,任何单位或个人认为我考网发布的内容可能涉嫌侵犯其合法权益,应该及时向我考网书面反馈,并提供身份证明、权属证明及详细侵权情况证明,我考网在收到上述法律文件后,将会尽快移除被控侵权内容。

最近更新

社区交流

考试问答