中国大学MOOC: 下列程序运行结果是( )public class demo { public static void main(String[] args) { int x=30; int[] numbers=new int[x]; x=60; System.out.println(numbers.length); }}
举一反三
- 下列程序运行结果是( )public class demo { public static void main(String[] args) { int x=30; int[] numbers=new int[x]; x=60; System.out.println(numbers.length); }} A: 60 B: 50 C: 30 D: 20
- 下面程序的运行结果是 ____ int x=30; int[] numbers=new int[x]; x=60; System.out.println(numbers.length);
- class Demo{ public static void main(String[] args){ int x = 0; try{ x = div(1,2); }catch(Exception e){ System.out.println(e); } System.out.println(x) ; } public static int div(int a,int b){ return a / b ; } }
- 以下程序运行结果是 public class Test { public static void main(String[] args) { int a=1,b[]={2}; add(a); add(b); System.out.println(a+","+b[0]); } static int add(int x){ x++; return x; } static void add(int[] x){ x[0]++; } }
- 请阅读下面的程序,选择正确的运行结果。class Demo{private static int x ;public static void main(String[] args){System.out.println(x++);}}