JAVA认证格林模拟试题三(下)
来源:优易学  2009-11-28 15:22:42   【优易学:中国教育考试门户网】   资料下载   IT书店
文章页内部300*250广告位

 

question 41)

you are creating an application that has a form with a text entry field used to enter a persons age. which of the following is appropriate for capturing this information.


1) use the text field of a textfield and parse the result using integer
2) use the getinteger method of the textfield
3) use the gettext method of a textbox and parse the result using the getint method of integer class
4) use the gettext method of a textfield and use the parseint method of the integer class


question 42)

given the following declaration


integer i=new integer(99);


how can you now set the value of i to 10?


1) i=10;
2) i.setvalue(10);
3) i.parseint(10);
4) none of the above


question 43)

which of the following statements are true

1) constructors cannot be overloaded
2) constructors cannot be overridden
3) a constructor can return a primitive or an object reference
4) constructor code executes from the current class up the hierarchy to the ancestor class


question 44)

given a reference called

t

to a class which extends thread, which of the following will cause it to give up cycles to allow another thread to execute.

1) t.yield();
2) thread.yield();
3) yield(100); //or some other suitable amount in milliseconds
4) yield(t);

question 45)

what will happen when you attempt to compile and run the following code?

public class sandys{
private int court;
public static void main(string argv[]){
        sandys s = new sandys(99);
        system.out.println(s.court);
        }
sandys(int ballcount){
        court=ballcount;
        }
}


1) compile time error, the variable court is defined as private
2) compile time error, s is not initialized when the system.out method is called
3) compilation and execution with no output
4) compilation and run with an output of 99


question 46)

which of the following statements are true?

1) a method cannot be overloaded to be less public in a child class
2) to be overridden a method only needs the same name and parameter types
3) to be overridden a method must have the same name, parameter and return types
4) an overridden method must have the same name, parameter names and parameter types


question 47)

what will happen when you attempt to compile and run the following code?

class base{
base(){
        system.out.println("base");
        }
}
public class checket extends base{
public static void main(string argv[]){
        checket c = new checket();
        super();
        }
checket(){
        system.out.println("checket");  
        }       
}

1) compile time error
2) checket followed by base
3) base followed by checket
4) runtime error

question 48)

which of the following statements are true?

1) static methods cannot be overriden to be non static
2) static methods cannot be declared as private
3) private methods cannot be overloaded
4) an overloaded method cannot throw exceptions not checked in the base class


question 49)

which of the following statements are true?

1) the automatic garbage collection of the jvm prevents programs from ever running out of memory
2) a program can suggest that garbage collection be performed but not force it
3) garbage collection is platform independent
4) an object becomes eligible for garbage collection when all references denoting it are set to null.


question 50)

given the following code

public class sytch{
int x=2000;
public static void main(string argv[]){
        system.out.println("ms "+argv[1]+"please pay $"+x);
        }
}

what will happen if you attempt to compile and run this code with the command line

java sytch jones diggle

1) compilation and output of ms diggle please pay $2000
2) compile time error
3) compilation and output of ms jones please pay $2000
4) compilation but runtime error


上一页  [1] [2] [3] 下一页

责任编辑:小草

收藏此页】【 】【打印】【回到顶部
计算机文章页底部500*200广告
文章搜索:
 相关文章
计算机底部580*90广告
文章页右侧第一330*280广告
计算机文章页资讯推荐
热点资讯
文章页330尺寸谷歌广告位
热门课程培训