可学答题网 > 问答 > SCJP程序员认证考试题库
目录: 标题| 题干| 答案| 搜索| 相关
问题

public void test(int x


public void test(int x) {  int odd = x%2;  if (odd) {   System.out.println(“odd);  } else {  System.out.println(“even”);  }  }  Which statement is true?() 

  • ACompilation fails.
  • B “odd” will always be output.
  • C “even” will always be output.
  • D “odd” will be output for odd values of x, and “even” for even values.
  • E “even” will be output for add values of x, and “odd” for even values.
参考答案
参考解析:
分类:SCJP程序员认证考试题库
相关推荐

1、static void test() thr

static void test() throws Error { if (true) throw new AssertionError(); System.out.print(test )...

2、11. public static void

11. public static void main(String[] args) { 12. Integer i = uew Integer(1) + new Inte...

3、11. public void addStr

11. public void addStrings(List list) { 12. list.add(foo); 13. list.add(bar); 14. } What mus...

4、11. public void someMe

11. public void someMethod(Object value) { 12. // check for null value .... 20. System.out.pr...

5、11. public static void

11. public static void test(String str) { 12. if(str == null  str.lellgth() == 0) {&...

6、static void test() thr

static void test() throws RuntimeException { try { System.out.print(test ); throw new RuntimeExcepti...