11. public void someMethod(Object value) {  12. // check for null value ....  20. System.out.println(value.getClass());  21. }  What, inserted at line 12, is the appropriate way to handle a null value?() A、 assert value == null;B、 assert value !null, “value is null”;C、 if (value == null) { throw new AssertionException(”value is null”);D、 if (value == null) { throw new IllegalArgumentException(”value is null”);

11. public void someMethod(Object value) {  12. // check for null value ....  20. System.out.println(value.getClass());  21. }  What, inserted at line 12, is the appropriate way to handle a null value?() 

  • A、 assert value == null;
  • B、 assert value !null, “value is null”;
  • C、 if (value == null) { throw new AssertionException(”value is null”);
  • D、 if (value == null) { throw new IllegalArgumentException(”value is null”);

相关考题:

Givenamethodthatmustensurethatitsparameterisnotnull:What,insertedatline12,istheappropriatewaytohandleanullvalue?() A.assertvalue==null;B.assertvalue!=null:valueisnull;C.if(value==null){thrownewAssertionException(valueisnull);}D.if(value==null){thrownewIllegalArgumentException(valueisnull);}

publicvoidsomeMethod(Objectvalue){12.//checkfornullvalue....20.System.out.println(value.getClass());21.}What,insertedatline12,istheappropriatewaytohandleanullvalue?() A.assertvalue==null;B.assertvalue!null,“valueisnull”;C.if(value==null){thrownewAssertionException(”valueisnull”);D.if(value==null){thrownewIllegalArgumentException(”valueisnull”);

Givenamethodthatmustensurethatitsparameterisnotnull:11.publicvoidsomeMethod(Objectvalue){12.//checkfornullvalue...20.System.out.println(value.getClass());21.}Whatinsertedatline12,istheappropriatewaytohandleanullvalue?()A.assertvalue==null;B.assertvalue!=null,valueisnull;C.if(value==null){thrownewAssertionException(valueisnull);}D.if(value==null){thrownewIllegalArgumentException(valueisnull);}

以下程序的运行结果为:public class My{int value;public static void main(String args[]) {My x=new My();if (x==null)System.out.println("No Object");elseSystem.out.println(x.value);}} A. 0B. 1C. No ObjectD. 编译错误E. null

Which 4 statements regarding MPLS Label Stack Encoding is true?()A、A value of 4 represents the "Implicit NULL Label."B、A value of 0 represents the "IPv4 Explicit NULL Label."C、A value of 1 represents the "Router Alert Label". The use of this label is analogous to the use of the"Router Alert Option" in IP packets (for example, ping with record route option)D、A value of 2 represents the "IPv6 Explicit NULL Label"E、A value of 1 represents the "IPv1 Explicit NULL Label"F、A value of 3 represents the "Implicit NULL Label"

1. public class SimpleCalc {  2. public int value;  3. public void calculate() { value += 7; }  4. } And:  1. public class MultiCalc extends SimpleCalc {  2. public void calculate() { value -= 3; }  3. public void calculate(int multiplier) {  4. calculate();  5. super.calculate();  6. value *=multiplier;  7. }  8. public static void main(String[] args) {  9. MultiCalc calculator = new MultiCalc();  10. calculator.calculate(2);  11. System.out.println(”Value is: “+ calculator.value);  12. }  13. }  What is the result?() A、 Value is: 8B、 Compilation fails.C、 Value is: 12D、 Value is: -12E、 The code runs with no output.F、 An exception is thrown at runtime.

Given the definition of MyServlet: 11.public class MyServlet extends HttpServlet { 12.public void service(HttpServletRequest request, 13.HttpServletResponse response) 14.throws ServletException, IOException { 15.HttpSession session = request.getSession(); 16.session.setAttribute("myAttribute","myAttributeValue"); 17.session.invalidate(); 18.response.getWriter().println("value=" + 19.session.getAttribute("myAttribute")); 20.} 21.} What is the result when a request is sent to MyServlet?()A、An IllegalStateException is thrown at runtime.B、An InvalidSessionException is thrown at runtime.C、The string "value=null" appears in the response stream.D、The string "value=myAttributeValue" appears in the response stream.

Which statements concerning the value of a member variable are true, when no explicit assignments have been made?()  A、The value of an int is undetermined.B、The value of all numeric types is zero.C、The compiler may issue an error if the variable is used before it is initialized.D、The value of a String variable is "" (empty string).E、The value of all object variables is null.

11. public class Test {  12. public void foo() {  13. assert false;  14. assert false;  15. }  16. public void bar(){  17. while(true){  18. assert false;  19. }  20. assert false;  21. }  22. }  What causes compilation to fail?()  A、 Line 13B、 Line 14C、 Line 18D、 Line 20

int index = 1;   boolean test = new Boolean;   boolean foo= test [index];  What is the result?()A、 Foo has the value of 0.B、 Foo has the value of null.C、 Foo has the value of true.D、 Foo has the value of false.E、 An exception is thrown.F、 The code will not compile.

String foo = “blue”;  Boolean[]bar = new Boolean [1];  if (bar[0])  {  foo = “green”;  }   What is the result? () A、 Foo has the value of “”B、 Foo has the value of null.C、 Foo has the value of “blue”D、 Foo has the value of “green”E、 An exception is thrown.F、 The code will not compile.

10. public class Hello {  11. String title;  12. int value;  13. public Hello() {  14. title += “ World”;  15. }  16. public Hello(int value) {  17. this.value = value;  18. title = “Hello”;  19. Hello();  20. }  21. }  and:  30. Hello c = new Hello(5);  31. System.out.println(c.title);  What is the result?() A、 HelloB、 Hello WorldC、 Compilation fails.D、 Hello World 5E、 The code runs with no output.F、 An exception is thrown at runtime.

Given a method that must ensure that its parameter is not null: 11. public void someMethod(Object value) { 12. // check for null value ... 20. System.out.println(value.getClass()); 21. } What inserted at line 12, is the appropriate way to handle a null value?()A、assert value == null;B、assert value != null, "value is null";C、if (value == null) { throw new AssertionException("value is null"); }D、if (value == null) { throw new IllegalArgumentException("value is null"); }

You need to design the restrictions on the Bank.Customers table. Which three actions should you perform?()A、Design a trigger that verifies that the first names and surnames are not empty strings.B、Design a check constraint that verifies that the first names and surnames are not empty strings.C、Design a check constraint that uses a CLR user-defined function to verify that either the phone number is a null value or the format of the phone number is valid.D、Design a trigger that uses a CLR user-defined function to verify that either the phone number is a null value or the format of the phone number is valid.E、Design a check constraint that ensures that the phone number cannot be changed from a valid format to a null value or to an invalid format.F、Design a trigger that ensures that the phone number cannot be changed from a valid format to a null value.

You are modifying a table named Product in a SQL Server 2005 database. You want to add a new column named FriendlyName to the Product table. A friendly name for each product will be stored in this column. The table currently contains data. The sales department has not yet created a friendly name for each product. FriendlyName is a required value for each product. You want to add this new column by using the least amount of effort. What should you do?()A、Define the new column as NULL.Update the FriendlyName column to the same value as the productName column. Alter the FriendlyName column to be NOT NULL.B、Define the new column as NOT NULL with a default value of ’Undefined.’C、Define the new column as NULL. Use application logic to enforce the data constraint.D、Define the new column as NULL with a default value of ’Undefined.’

单选题Given a method that must ensure that its parameter is not null: 11. public void someMethod(Object value) { 12. // check for null value ... 20. System.out.println(value.getClass()); 21. } What inserted at line 12, is the appropriate way to handle a null value?()Aassert value == null;Bassert value != null, value is null;Cif (value == null) { throw new AssertionException(value is null); }Dif (value == null) { throw new IllegalArgumentException(value is null); }

多选题Which statements concerning the value of a member variable are true, when no explicit assignments have been made?()AThe value of an int is undetermined.BThe value of all numeric types is zero.CThe compiler may issue an error if the variable is used before it is initialized.DThe value of a String variable is  (empty string).EThe value of all object variables is null.

单选题Given a method that must ensure that its parameter is not null: 11. public void someMethod(Object value) { 12. // check for null value ... 20. System.out.println(value.getClass()); 21. } What inserted at line 12, is the appropriate way to handle a null value?()Aassert value == null;Bassert value != null, value is null;Cif (value == null) { throw new AssertionException(value is null); }Dif (value == null) { throw new IllegalArgumentException(value is null); }

单选题String foo = “blue”;    Booleanbar = new Boolean [1];    if (bar[0]) {    foo = “green”;    }   What is the result?()A Foo has the value of “”B Foo has the value of null.C Foo has the value of “blue”D Foo has the value of “green”E An exception is thrown.F The code will not compile.

单选题Given the definition of MyServlet: 11.public class MyServlet extends HttpServlet { 12.public void service(HttpServletRequest request, 13.HttpServletResponse response) 14.throws ServletException, IOException { 15.HttpSession session = request.getSession(); 16.session.setAttribute("myAttribute","myAttributeValue"); 17.session.invalidate(); 18.response.getWriter().println("value=" + 19.session.getAttribute("myAttribute")); 20.} 21.} What is the result when a request is sent to MyServlet?()AAn IllegalStateException is thrown at runtime.BAn InvalidSessionException is thrown at runtime.CThe string value=null appears in the response stream.DThe string value=myAttributeValue appears in the response stream.

多选题You need to design the restrictions on the Bank.Customers table. Which three actions should you perform?()ADesign a trigger that verifies that the first names and surnames are not empty strings.BDesign a check constraint that verifies that the first names and surnames are not empty strings.CDesign a check constraint that uses a CLR user-defined function to verify that either the phone number is a null value or the format of the phone number is valid.DDesign a trigger that uses a CLR user-defined function to verify that either the phone number is a null value or the format of the phone number is valid.EDesign a check constraint that ensures that the phone number cannot be changed from a valid format to a null value or to an invalid format.FDesign a trigger that ensures that the phone number cannot be changed from a valid format to a null value.

单选题You are modifying a table named Product in a SQL Server 2005 database. You want to add a new column named FriendlyName to the Product table. A friendly name for each product will be stored in this column. The table currently contains data. The sales department has not yet created a friendly name for each product. FriendlyName is a required value for each product. You want to add this new column by using the least amount of effort. What should you do?()ADefine the new column as NULL.Update the FriendlyName column to the same value as the productName column. Alter the FriendlyName column to be NOT NULL.BDefine the new column as NOT NULL with a default value of ’Undefined.’CDefine the new column as NULL. Use application logic to enforce the data constraint.DDefine the new column as NULL with a default value of ’Undefined.’

单选题11. public void someMethod(Object value) {  12. // check for null value ....  20. System.out.println(value.getClass());  21. }  What, inserted at line 12, is the appropriate way to handle a null value?()A assert value == null;B assert value !null, “value is null”;C if (value == null) { throw new AssertionException(”value is null”);D if (value == null) { throw new IllegalArgumentException(”value is null”);

单选题int index = 1;   boolean test = new Boolean;   boolean foo= test [index];  What is the result?()A Foo has the value of 0.B Foo has the value of null.C Foo has the value of true.D Foo has the value of false.E An exception is thrown.F The code will not compile.

多选题Which 4 statements regarding MPLS Label Stack Encoding is true?()AA value of 4 represents the Implicit NULL Label.BA value of 0 represents the IPv4 Explicit NULL Label.CA value of 1 represents the Router Alert Label. The use of this label is analogous to the use of theRouter Alert Option in IP packets (for example, ping with record route option)DA value of 2 represents the IPv6 Explicit NULL LabelEA value of 1 represents the IPv1 Explicit NULL LabelFA value of 3 represents the Implicit NULL Label

单选题What is the result?()A  foo has the value””B  foo has the value null.C  An exception is thrown.D  The code will not compile.

单选题11. public class Test {  12. public void foo() {  13. assert false;  14. assert false;  15. }  16. public void bar(){  17. while(true){  18. assert false;  19. }  20. assert false;  21. }  22. }  What causes compilation to fail?()A Line 13B Line 14C Line 18D Line 20