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

文章作者 100test 发表时间 2007:03:14 17:06:02
来源 100Test.Com百考试题网


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



相关文章


JAVA题库:格林模拟试题二(上)(2)
SCJP考试辅导第二章:if语句和switch语句
JBoss与Sun的Java标准之争日趋严重
JavaIDE漫谈(-)——VAJ之后是什么?
JAVA题库:格林模拟试题二(上)(4)
JAVA题库:格林模拟试题二(上)(3)
技巧心得:SCJP考试心得集
Sun让软件没有国界
JAVA题库:格林模拟试题二(上)(6)
澳大利亚华人论坛
考好网
日本华人论坛
华人移民留学论坛
英国华人论坛