单选题int[]my_Array; my_Array=newint[5]; for(intcount=0;count<=5;count++)System.out.println(my_Array[count]); 以上Java代码运行的结果是()。A 将1,2,3,4,5输出到屏幕B 将0,1,2,3,4输出到屏幕C 将0,1,2,3,4,5输出到屏幕D 将出现运行时异常

题目
单选题
int[]my_Array; my_Array=newint[5]; for(intcount=0;count<=5;count++)System.out.println(my_Array[count]); 以上Java代码运行的结果是()。
A

将1,2,3,4,5输出到屏幕

B

将0,1,2,3,4输出到屏幕

C

将0,1,2,3,4,5输出到屏幕

D

将出现运行时异常


相似考题
更多“单选题int[]my_Array; my_Array=newint[5]; for(intcount=0;count=5;count++)System.out.println(my_Array[count]); 以上Java代码运行的结果是()。A 将1,2,3,4,5输出到屏幕B 将0,1,2,3,4输出到屏幕C 将0,1,2,3,4,5输出到屏幕D 将出现运行时异常”相关问题
  • 第1题:

    ( 27 )有如下程序:

    #include <iostream>

    using namespace std;

    class Toy{

    public:

    Toy(char* _n) { strcpy (name,_n); count++;}

    ~Toy(){ count--; }

    char* GetName(){ return name; }

    static int getCount(){ return count; }

    private:

    char name[10];

    static int count;

    };

    int Toy::count=0;

    int mail(){

    Toy t1("Snoopy"),t2("Mickey"),t3("Barbie");

    cout<<t1.getCount()<<endl;

    return 0;

    }

    运行时的输出结果是

    A ) 1

    B ) 2

    C ) 3

    D )运行时出错


    正确答案:C

  • 第2题:

    阅读下列程序段

    int i=3,j;

    outer:while(i>0){

    j=3;

    inner:while(j>0){

    if(j<2) break outer;

    System.out.println(j+"and"+i);

    j--;

    }

    i--;

    }

    被输出到屏幕的第一行结果是【 】 。


    正确答案:3 and 3
    3 and 3 解析:本题考查Java的break跳转语句。在Java中,可以用break语句推出循环,并从紧跟该循环结构的第一条语句处开始执行。此外,break语句还提供了一个“标签化中断”的语句,可让程序退出多重嵌套循环。其中,标签就是加在要中断的那个循环之前,同时在这个标签后面必须跟一个冒号(:)。本题程序中inner和outer就是两个标签,分别加在内外两个循环之前。
      本题程序中,在生成两个变量i和j后,就判断i>0的结果为true,因此执行外层循环体。在外层循环中,首先为变量j赋值,然后判断条件j>0的结果也为true,因此执行内层循环体,首先判断条件j2的结果为false,则不执行if语句中的break outer语句,而继续执行System.out.println(j+"and"+i)语句,即输出“3 and 3”。然后j的值减1,返回到外层while循环的开始继续判断条件。
      经过上述分析可知,本题划线处应填入“3 and 3”。

  • 第3题:

    下面程序的正确输出是( )。 Publicclasshello { Publicstaticvoidmain(Stringargs[]) { Intcount,xPos=25; For(count=1;count<=10;count++) { IRcount==5) Break; System.out.println(count); xPos+=10; } } }

    A.1 2 34

    B.1 34

    C.编译错误

    D.以上都不正确


    正确答案:A
    解析: 该程序经过编译、运行后,在屏幕上显示:1 2 3 4。publicclassHello中Hello为类名,publicstaticvoidmain(String argsm有关参数的解释如下。public表示该方法可以被任意代码所调用,包括Java解释器。static它告诉编译器,main()方法是一个类方法,可以通过类名直接调用,调用时不需要该类的实例对象。void表示main()方法没有返回值。这是非常重要的。因为 Java类型检查非常严格,包括检查这些方法返回值的类型是否与声明的一致。String args[]声明一个字符串类型的数组,它是命令行传递给main()方法的参数,参数在命令行中出现在类名称后面。包含main()方法的类(Hello为包含main()方法的类名)名称必须与其文件名相同,也就是说,其文件名必须为Hello.iava。经过编译,在当前文件夹下将出现一个Hello.class文件,这就足编译后的字节码文件。在程序段最后有两个人括号,分别说明结束main()方法和Hello类。在本程序中由厂有count==5这个条件判断,因此当count==5时,程序结束,输出为1 234。

  • 第4题:

    程序段intcount=0;char*s=”ABCD”;while(*s!=’/0’){s++;count++;}执行后count=()。
    4

  • 第5题:

    int [] my_Array;  my_Array = new int[5];  for(int count = 0; count <= 5; count++)  System.out.println(my_Array[count]); 结果是()

    • A、将1,2,3,4,5输出到屏幕
    • B、将0,1,2,3,4输出到屏幕
    • C、将0,1,2,3,4,5输出到屏幕
    • D、将出现运行时异常

    正确答案:D

  • 第6题:

    For debugging purposes, you need to record how many times a given JSP is invoked before the user’ssession has been created. The JSP’s destroy method stores this information to a database. Which JSPcode snippet keeps track of this count for the lifetime of the JSP page?()

    • A、<%! int count = 0; %><% if ( request.getSession(false) == null ) count++; %>
    • B、<%@ int count = 0; %>. <% if ( request.getSession(false) == null ) count++; %>
    • C、<% int count = 0;. if ( request.getSession(false) == null ) count++; %>
    • D、<%@ int count = 0;. if ( request.getSession(false) == null ) count++; %>
    • E、<%! int count = 0;. if ( request.getSession(false) == null ) count++; %>

    正确答案:A

  • 第7题:

    int[]my_Array; my_Array=newint[5]; for(intcount=0;count<=5;count++)System.out.println(my_Array[count]); 以上Java代码运行的结果是()。

    • A、将1,2,3,4,5输出到屏幕
    • B、将0,1,2,3,4输出到屏幕
    • C、将0,1,2,3,4,5输出到屏幕
    • D、将出现运行时异常

    正确答案:D

  • 第8题:

    编译如下Java程序片断:  class test{  int count = 9;  public void a(){    int count=10;  System.out.println("count 1 =" + count);  }  public void count(){  System.out.println("count 2 =" + count);  }  public static void main(String args[]){    test t=new test();    t.a();   t.count();   } }  结果将()。    

    • A、不能通过编译
    • B、输出:       count 1 = 10        count 2 = 9
    • C、输出:          count 1 = 9          count 2 = 9

    正确答案:B

  • 第9题:

    单选题
    在linux下echohello>test这条命令中”>”符号的作用是()。
    A

    比较hello与test文件的内容

    B

    将hello这个字符输出到屏幕上

    C

    将hello这个字符输出到test文件中

    D

    什么都不作


    正确答案: A
    解析: 暂无解析

  • 第10题:

    填空题
    程序段intcount=0;char*s=”ABCD”;while(*s!=’/0’){s++;count++;}执行后count=()。

    正确答案: 4
    解析: 暂无解析

  • 第11题:

    判断题
    屏幕显示是指将各种报表输出到屏幕上,报表使用者可以通过屏幕查看报表。()
    A

    B


    正确答案:
    解析: 暂无解析

  • 第12题:

    单选题
    int [] my_Array;   My_Array=new int [5];   For(int count = 0 ;  count <=5; count ++)    System.out.pringtln(my_Array[count]);   以上Java代码运行的结果是()
    A

    将1,2,3,4,5输出到屏幕

    B

    将0,1,2,3,4输出到屏幕

    C

    将0,1,2,3,4,5输出到屏幕

    D

    将出现运行时异常


    正确答案: D
    解析: 暂无解析

  • 第13题:

    ( 9 )阅读下列程序段

    int i=3 , j ;

    outer:while ( i>0 ){

    J=3;

    inner:while ( j>0 ){

    if ( j<2 ) break outer;

    System.out.println ( j+"and"+i ) ;

    j-- ;

    i--;

    }

    被输出到屏幕的第一行结果是 【 9 】


    正确答案:

  • 第14题:

    Fordebuggingpurposes,youneedtorecordhowmanytimesagivenJSPisinvokedbeforetheuser’ssessionhasbeencreated.TheJSP’sdestroymethodstoresthisinformationtoadatabase.WhichJSPcodesnippetkeepstrackofthiscountforthelifetimeoftheJSPpage?()

    A.<%!intcount=0;%><%if(request.getSession(false)==null)count++;%>

    B.<%@intcount=0;%>.<%if(request.getSession(false)==null)count++;%>

    C.<%intcount=0;.if(request.getSession(false)==null)count++;%>

    D.<%@intcount=0;.if(request.getSession(false)==null)count++;%>

    E.<%!intcount=0;.if(request.getSession(false)==null)count++;%>


    参考答案:A

  • 第15题:

    给出下列代码段: int i=3,j; outer:while(i>0) { j=3; inner:while(j>0) { if(j<3) break outer; System.out.println(j+"and"+i); j--; } i--; }下列选项中( )会被输出到屏幕。

    A.3 and 3

    B.3 and 2

    C.3 and 1

    D. 3 and 0


    正确答案:A

  • 第16题:

    int [] my_Array;   My_Array=new int [5];   For(int count = 0 ;  count <=5; count ++)    System.out.pringtln(my_Array[count]);   以上Java代码运行的结果是()  

    • A、将1,2,3,4,5输出到屏幕
    • B、将0,1,2,3,4输出到屏幕
    • C、将0,1,2,3,4,5输出到屏幕
    • D、将出现运行时异常

    正确答案:D

  • 第17题:

    You need to create a JSP that generates some JavaScript code to populate an array of strings used on theclient-side. Which JSP code snippet will create this array?()

    • A、MY_ARRAY = new Array();<% for ( int i = 0; i < serverArray.length; i++ ) { MY_ARRAY[<%= i %>] = ’<%= serverArray[i] %>’;} %>
    • B、MY_ARRAY = new Array();. <% for ( int i = 0; i < serverArray.length; i++ ) { . MY_ARRAY[${i}] = ’${serverArray[i]}’;. } %>
    • C、MY_ARRAY = new Array();. <% for ( int i = 0; i < serverArray.length; i++ ) { %> . MY_ARRAY[<%= i %>] = ’<%= serverArray[i] %>’;. <% } %>
    • D、MY_ARRAY = new Array();<% for ( int i = 0; i < serverArray.length; i++ ) { %> . MY_ARRAY[${i}] = ’${serverArray[i]}’;. <% } %>

    正确答案:C

  • 第18题:

    在linux下echohello>test这条命令中”>”符号的作用是()。

    • A、比较hello与test文件的内容
    • B、将hello这个字符输出到屏幕上
    • C、将hello这个字符输出到test文件中
    • D、什么都不作

    正确答案:C

  • 第19题:

    屏幕显示是指将各种报表输出到屏幕上,报表使用者可以通过屏幕查看报表。()


    正确答案:正确

  • 第20题:

    单选题
    You need to create a JSP that generates some JavaScript code to populate an array of strings used on theclient-side. Which JSP code snippet will create this array?()
    A

    MY_ARRAY = new Array();<% for ( int i = 0; i < serverArray.length; i++ ) { MY_ARRAY[<%= i %>] = ’<%= serverArray[i] %>’;} %>

    B

    MY_ARRAY = new Array();. <% for ( int i = 0; i < serverArray.length; i++ ) { . MY_ARRAY[${i}] = ’${serverArray[i]}’;. } %>

    C

    MY_ARRAY = new Array();. <% for ( int i = 0; i < serverArray.length; i++ ) { %> . MY_ARRAY[<%= i %>] = ’<%= serverArray[i] %>’;. <% } %>

    D

    MY_ARRAY = new Array();<% for ( int i = 0; i < serverArray.length; i++ ) { %> . MY_ARRAY[${i}] = ’${serverArray[i]}’;. <% } %>


    正确答案: D
    解析: 暂无解析

  • 第21题:

    单选题
    编译如下Java程序片断:  class test{  int count = 9;  public void a(){    int count=10;  System.out.println("count 1 =" + count);  }  public void count(){  System.out.println("count 2 =" + count);  }  public static void main(String args[]){    test t=new test();    t.a();   t.count();   } }  结果将()。
    A

    不能通过编译

    B

    输出:       count 1 = 10        count 2 = 9

    C

    输出:          count 1 = 9          count 2 = 9


    正确答案: C
    解析: 暂无解析

  • 第22题:

    单选题
    int [] my_Array;  my_Array = new int[5];  for(int count = 0; count <= 5; count++)  System.out.println(my_Array[count]); 结果是()
    A

    将1,2,3,4,5输出到屏幕

    B

    将0,1,2,3,4输出到屏幕

    C

    将0,1,2,3,4,5输出到屏幕

    D

    将出现运行时异常


    正确答案: D
    解析: 暂无解析

  • 第23题:

    单选题
    For debugging purposes, you need to record how many times a given JSP is invoked before the user’ssession has been created. The JSP’s destroy method stores this information to a database. Which JSPcode snippet keeps track of this count for the lifetime of the JSP page?()
    A

    <%! int count = 0; %><% if ( request.getSession(false) == null ) count++; %>

    B

    <%@ int count = 0; %>. <% if ( request.getSession(false) == null ) count++; %>

    C

    <% int count = 0;. if ( request.getSession(false) == null ) count++; %>

    D

    <%@ int count = 0;. if ( request.getSession(false) == null ) count++; %>

    E

    <%! int count = 0;. if ( request.getSession(false) == null ) count++; %>


    正确答案: B
    解析: 暂无解析