下面代码的运行结果是( )。public class Test {public static void main(System[] args){int[ ] a ={10,20,30};int[ ] b ={1,2,3,4,5};a=b;for (int i=0;i<a.length;i++){System.out.print(a[i]+” ”);}}}[/i]
A: 程序报错
B: 10 20 30
C: 1 2 3 4 5
D: 1 2 3
A: 程序报错
B: 10 20 30
C: 1 2 3 4 5
D: 1 2 3
举一反三
- 下面代码的运行结果是。 public class Test { public static void main(System[] args){ int[ ] a ={10,20,30}; int[ ] b ={1,2,3,4,5}; a=b; for (int i=0;i<a.length;i++){ System.out.print(a[i]+” ”); } } }[/i]
- 下面代码的运行结果是_____________。 public class Test{ public static void main(String[] args){ int[] a=new int[3]; int[] b= new int[]{1,2,3,4,5}; a=b; for(int i=0; i<b.length; i++){ System.out.print(a[i]+" "); } } }[/i]
- 下列程序的运行结果是()。 public class Test public static void main ( String [ ] args ) int count = 0 for( int i = 1 i < 5 i = 2) for( int j = 1 j< = 10 j = 3) count System .out .print (count ) _
- 以下程序的输出结果是【 】。 class Program { public static void Main(string[] args) { int[] a = new int[3] { 1, 2, 3 }; for (int i = 0; i < 3; i++) Console.Write("{0} ", a[i]); Console.WriteLine(); int[] b = a; for (int i = 0; i < 3; i++) b[i] = 2 * b[i]; for (int i = 0; i < 3; i++) Console.Write("{0} ", a[i]); Console.WriteLine(); Console.Read(); } }[/i][/i][/i][/i]
- using System; class Test { public static void Main () { int[ ] a ={2,4,6,8,10,12,14,16,18}; for (int i=0; i<9; i++) { Console.write(“ ”+a[i]); if ((i+1)%3==0) Console.writeLine(); } } }[/i]