参考答案和解析
正确答案:B
更多“下列变量的定义中,错误的是()A、intx=8;B、floatf;d;C、Strings="hello";D、booleanb=true;”相关问题
  • 第1题:

    下面哪些赋值语句是错误的()。

    A.floatf=11.1;

    B.doubled=5.3E12;

    C.charc=’\r’;

    D.Booleanb=true;


    参考答案:A

  • 第2题:

    publicclassTest{publicstaticvoidmain(String[]args){intx=5;booleanb1=true;booleanb2=false;if((x==4)&&!b2)System.out.print(”l);System.out.print(”2);if((b2=true)&&b1)System.out.print(”3);}}Whatistheresult?()

    A.2

    B.3

    C.12

    D.23

    E.123

    F.Compilationfails.

    G.Auexceptionalisthrownatruntime.


    参考答案:D

  • 第3题:

    publicclassX{publicstaticvoidmain(String[]args){Strings1=newString(true”);Booleanb1=newBoolean(true);if(s2.equals(b1)){System.out.printIn(Equal”);}}}Whatistheresult?()

    A.Theprogramrunsandprintsnothing.

    B.Theprogramrunsandprints“Equal”

    C.Anerroratline5causescompilationtofail.

    D.Theprogramrunsbutabortswithanexception.


    参考答案:A

  • 第4题:

    publicclassX{publicstaticvoidmain(Stringargs){Strings1=newString(true”);Booleanb1=newBoolean(true);if(s2.equals(b1)){System.out.printIn(Equal”);}}}Whatistheresult?()

    A.Theprogramrunsandprintsnothing.

    B.Theprogramrunsandprints“Equal”

    C.Anerroratline5causescompilationtofail.

    D.Theprogramrunsbutabortswithanexception.


    参考答案:A

  • 第5题:

    下列代码的执行结果是()。publicclasstest5{publicstaticvoidmain(Stringargs[]){Strings1=newString("hello");Strings2=newString("hello");System.out.prim(s1==s2);System.out.print(",");System.out.println(s1.equals(s2));}

    A.true,false

    B.true,true

    C.false,true

    D.false,false


    正确答案:C

  • 第6题:

    下列关于注释的使用,错误的是?()

    A、intc=10;//定义变量c

    B、*/intc=5;intx=6;*/

    C、/**这是类的入口方法*/

    D、/*/*intc=10;*/intx=5;*/


    正确答案:D

  • 第7题:

    在java中,下列()语句不能通过编译。

    • A、Strings="john"+"was"+"here";
    • B、Strings="john"+3;
    • C、floatf=5+5.5;
    • D、inta=3+5;

    正确答案:C

  • 第8题:

    已定义下列变量:intn;floatf;doubledf;df=10;n=2;下列语句正确的是()

    • A、f=df
    • B、f=12.3
    • C、n=df
    • D、df=n=100

    正确答案:D

  • 第9题:

    下列语句定义pf为指向float类型变量f的指针,()是正确的。

    • A、floatf,*pf=f;
    • B、floatf,*pf=&f;
    • C、float*pf=&f,f;
    • D、floatf,pf=f;

    正确答案:B

  • 第10题:

    单选题
    已定义下列变量:intn;floatf;doubledf;df=10;n=2;下列语句正确的是()
    A

    f=df

    B

    f=12.3

    C

    n=df

    D

    df=n=100


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

  • 第11题:

    单选题
    用于文本*区中设置文本同时清除文本*区中原有文本的方法是()
    A

    setText(Strings)

    B

    getText()

    C

    TextArea(Strings)

    D

    TextArea(intx,inty)


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

  • 第12题:

    单选题
    下列函数参数默认值定义错误的是()。
    A

    Fun(intx,inty=0)

    B

    Fun(intx=100)

    C

    Fun(intx=0,inty)

    D

    Fun(intx=f())(假定函数f()已经定义)


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

  • 第13题:

    publicclassParent{publicvoidchange(intx){}}publicclassChildextendsParent{//覆盖父类change方法}下列哪个声明是正确的覆盖了父类的change方法?()

    A.protectedvoidchange(intx){}

    B.publicvoidchange(intx,inty){}

    C.publicvoidchange(Strings){}

    D.publicvoidchange(intx){}


    参考答案:D

  • 第14题:

    publicclassX{publicstaticvoidmain(String[]args){strings=newstring(Hello”);modify(s);System.out.printIn(s);}publicstaticvoidmodify(Strings){s+=world!”;}}Whatistheresult?()

    A.Theprogramrunsandprints“Hello”

    B.Anerrorcausescompilationtofail.

    C.Theprogramrunsandprints“Helloworld!”

    D.Theprogramrunsbutabortswithanexception.


    参考答案:A

  • 第15题:

    publicclassX{publicstaticvoidmain(Stringargs){strings=newstring(Hello”);modify(s);System.out.printIn(s);}publicstaticvoidmodify(Strings){s+=world!”;}}Whatistheresult?()

    A.Theprogramrunsandprints“Hello”

    B.Anerrorcausescompilationtofail.

    C.Theprogramrunsandprints“Helloworld!”

    D.Theprogramrunsbutabortswithanexception.


    参考答案:A

  • 第16题:

    在VBA中,如果没有显式声明或用符号来定义变量的数据类型,变量的默认数据类型为A.Boolean

    在VBA中,如果没有显式声明或用符号来定义变量的数据类型,变量的默认数据类型为

    A.Boolean

    B.Int

    C.String

    D.Variant


    正确答案:D
    在VBA中,如果没有显式声明或用符号来定义变量的数据类型,变量的默认数据类型为Variant。所以本题答案为D。

  • 第17题:

    下列变量的定义中,错误的是( )。

    A.int X=3;

    B.float f;d;

    C.String s="Hell0";

    D.boolean b=true;


    正确答案:B
    B。【解析】正确的方法是floatf,d;,中间应该使用“,”而不是“;”,因为在Java中“;”表示一个语句结束。

  • 第18题:

    用于文本*区中设置文本同时清除文本*区中原有文本的方法是()

    • A、setText(Strings)
    • B、getText()
    • C、TextArea(Strings)
    • D、"TextArea(intx,inty)"

    正确答案:A

  • 第19题:

    VBA中如果没有显式声明或未用符号来定义变量的数据类型,则变量的默认数据类型为()

    • A、Boolean
    • B、Int
    • C、String
    • D、Variant

    正确答案:D

  • 第20题:

    已知:intm=10;下列表示引用的方法中,正确的是()

    • A、int&Z
    • B、int&t=10
    • C、int&X=m
    • D、float&f=&m

    正确答案:C

  • 第21题:

    下列函数参数默认值定义错误的是()。

    • A、Fun(intx,inty=0)
    • B、Fun(intx=100)
    • C、Fun(intx=0,inty)
    • D、Fun(intx=f())(假定函数f()已经定义)

    正确答案:C

  • 第22题:

    单选题
    下列变量的定义中,错误的是()
    A

    intx=8;

    B

    floatf;d;

    C

    Strings=hello;

    D

    booleanb=true;


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

  • 第23题:

    单选题
    下列变量定义中,错误的是(  )。
    A

    int x=3;

    B

    float f;d;

    C

    String S=“Hello!”;

    D

    boolean b=true;


    正确答案: B
    解析:
    A项定义了一个整型变量,C项定义了一个字符串,D项定义了一个布尔型变量,这三个定义都是正确的;B选项中的f;d不符合标识符规范,因而选B。