阅读下段代码片段,选择正确的运行结果 public static void main(String[] args) { { int a = 1; System.out.print(a); } { int a = 2; System.out.print(a); } int a = 3; System.out.print(a); }
举一反三
- 阅读下段代码片段 public static void main(String[] args) { { int a = 1; System.out.print(a); } { int a = 2; System.out.print(a); } int a = 3; System.out.print(a); } 下列选项中,哪一个是程序正确的运行结果
- 下列程序的运行结果是()。 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 ) _
- 以下程序的运行结果是:() public class Increment{ public static void main(String args[]) { int a; a = 6; System.out.print(a); System.out.print(a++); System.out.print(a); } }
- 以下程序的运行结果是:( )public class Increment{ public static void main(String[] args) { int a; a = 6; System.out.print(a); System.out.print(a++); System.out.print(a); System.out.print(--a); System.out.print(a); }} A: 66666 B: 66766 C: 67766 D: 67666
- 下列选项中,循环会无限执行的是______。 A: int i = 1 ; while ( i < 10) System .out .print( “ ” + i) ; B: for( int i = 1 ; i < 10 ;i ++) System .out .print( “ ” + i); C: for( int i = 10 ; i > 0 ;i --) System .out .print( “ ” + i); D: int i = 1 ; while (true) { System .out .print( “ ” + i); i ++ ; if ( i > 5) break ;