black

SCJP程序员认证考试

登录

单项选择题

public class Yikes { 
public static void go(Long n) {System.out.println(”Long “);} 
public static void go(Short n) {System.out.println(”Short “);} 
public static void go(int n) {System.out.println(”int “);} 
public static void main(String [] args) { 
short y= 6; 
long z= 7; 
go(y); 
go(z); 
} 
} 
What is the result?() 

A. int Long
B. Short Long
C. Compilation fails.
D. An exception is thrown at runtime.

相关考题

多项选择题 public class TestString3 {  public static void main(String[] args) {  // insert code here  System.out.println(s);  }  }  Which two code fragments, inserted independently at line 3, generate the output 4247?()

单项选择题 public String makinStrings() {  String s = “Fred”;  s = s + “47”;  s = s.substring(2, 5);  s = s.toUpperCase();  return s.toString();  }  How many String objects will be created when this method is invoked?()

单项选择题 public class MyLogger {  private StringBuilder logger = new StringBuuilder();  public void log(String message, String user) {  logger.append(message);  logger.append(user);  }  }  The programmer must guarantee that a single MyLogger object works properly for a multi-threaded system. How must this code be changed to be thread-safe?()

All Rights Reserved 版权所有©易学考试网(yxkao.com)

备案号:湘ICP备2022003000号-3