首页 > 电气工程及其自动化> 发电厂电气部分
题目内容 (请给出正确答案)
[主观题]

如下Java的类定义: public class Example{ static int X[]=new int[15]; public static void main(Strin

如下Java的类定义:

public class Example{

static int X[]=new int[15];

public static void main(String args[]){

System.out.printin(x[5]);

}

}

说法正确的是______。

A.编译时出错 B.运行时出错

C.输出0 D.无输出

查看答案
答案
收藏
如果结果不匹配,请 联系老师 获取答案
您可能会需要:
您的账号:,可能还需要:
您的账号:
发送账号密码至手机
发送
安装优题宝APP,拍照搜题省时又省心!
更多“如下Java的类定义: public class Examp…”相关的问题
第1题
如下Java的类定义: publiC class Example{ publ ic StatiC VOid main(String args[]){ StatiC int x[]=n

如下Java的类定义:

publiC class Example{

publ ic StatiC VOid main(String args[]){

StatiC int x[]=new int[15]j

System.out.printin(X[5])j

}

)

说法正确的是______。

A.编译时出错 B.运行时出错

C.输出结果为0 D.无输出

点击查看答案
第2题
在一个合法的java源程序文件中定义了3个类,则其中属性为public的类可能有_________个。

A.1

B.0

C.2

D.3

点击查看答案
第3题
下面是一个类的定义,请将程序补充完整。 import java awt.*; import java applet.*:
public class myprogram extends Applet // 定义小程序的主类 { Label p1; TextField in: publicvoidinit() {p1=new Label("请输入一个整数"); _______; in=new TextField(8); add(in); } }

点击查看答案
第4题
有如下类定义:classMyClass{intvalue;public:MyClass(intn):value(n){}intgerValue()const{returnvalue;}};则类MyClass的构造函数的个数是()

A.1个

B.2个

C.3个

D.4个

点击查看答案
第5题
若类A和类B的定义如下: class A { int I, j; public: void get(); //、、}; class B :A{ int k; public: void make(){ k=I*j; }则上述定义中,()是非法的表达式。

A.void get();

B. int k;

C. void make();

D. k=I*j;

点击查看答案
第6题
若类A和类B的定义如下:class A{int i,j;public:void get();//…};class B:A//默认为私有派生{int

若类A和类B的定义如下: class A { int i,j; public: void get(); //… } ; class B:A//默认为私有派生 { int k; public: void make(); //… }; void B::make() { k=i*j; } 则上述定义中, ()是非法的表达式。

A.void get();

B.int k;

C.void make();

D.k=i*j;

点击查看答案
第7题
一个Java源文件中有如下类的定义publicclassEx2523{……}为了让该文件可以编译运行,则该文件的文件名必须为()

A.Ex2523.class

B.Ex2523.j

C.Ex2523.java

D.没有要求

点击查看答案
第8题
类A及其派生类B定义如下:class A{ public int getIno(int a) { return a; }}pub

类A及其派生类B定义如下:class A{ public int getIno(int a) { return a; }}public class B extends A{ public loat getIno(int b) { return b; } public static void main(String[]args) { A a=new A(); B b=new B(); System.out.println(a.getIno(3)+","+b.getIno(5)); }}关于上述程序代码的叙述中正确的是 ()

A.第10行不能通过编译

B.程序通过编译,输出结果为:3,3

C.程序通过编译,输出结果为3,5

D.程序通过编译,输出结果为:5,5

点击查看答案
第9题
172、已知Circle类定义如下所示,则下列说法正确的是。 class Circle { public: double m_x,m_y; double m_radius; void setCenter(double x,double y) { m_x=x; m_y=y; } void setRadius(double radius) { m_radius=radius; } double getArea() { return 3.14 * m_radius * m_radius; } };

A.m_x、m_y和m_radius都是Circle类的成员变量

B.setCenter、setRadius和getArea都是Circle类的成员函数

C.类定义体后面的分号可以省略

D.将double m_radius;改为double m_radius=1;,则表示m_radius成员变量的初值为1

点击查看答案
第10题
public class boy{}public class girl{}public class student extends boy,girl{}上述定义()

public class boy{}public class girl{}public class student extends boy,girl{}上述定义()

A、正确

B、错误,Java不允许多重继承

C、错误boy和girl应该用

D、隔开

E、错误,应该使用implements关键字

点击查看答案
第11题
Java源文件中最多只能有一个(),其他类的个数不限。

A.public

B.interface

C.final

D.abstract

点击查看答案
退出 登录/注册
发送账号至手机
密码将被重置
获取验证码
发送
温馨提示
该问题答案仅针对搜题卡用户开放,请点击购买搜题卡。
马上购买搜题卡
我已购买搜题卡, 登录账号 继续查看答案
重置密码
确认修改