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
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
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
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);
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
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
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
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.
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
责任编辑:小草