填空题 阅读程序,指出错误并改正。 public class Calculation { public int multiply(double x, double y) { double result; result = x * y; return result; } }

下载APP答题
由4l***7c提供 分享 举报 纠错

相关试题

单选题 下面是关于数组的声明,其中正确的是( )。

A、int [] a = new int [3.5];
B、double [] d = new double {4,5,6};
C、char [] c = new char [8];
D、String [][] s = new String [][3];

单选题 下列选项中,( )是 Java 中的关键字。

A、run
B、static
C、print
D、input

单选题 关于 Java 中的 for 循环,下列说法正确的是

A、for 循环的循环体至少无条件执行一次
B、for 循环的循环变量必须在循环体内修改
C、for 循环通常用于已知循环次数的情况
D、for 循环的循环条件可以省略

单选题 下面关于接口和实现类的说法正确的是( )。

A、接口中可以包含实例变量
B、一个类只能实现一个接口
C、接口中的方法默认是 public abstract 的
D、接口可以包含构造方法

单选题 下面声明类 Employee 的构造方法中,正确的是?( )

A、void Employee (String name){}
B、Employee void (int salary){ }
C、employee (String name){ }
D、Employee (String name, int salary){}

单选题 用 public 修饰成员变量时,下面说法正确的是( )

A、只能被同一个包中的其他类访问
B、只能被所在类访问
C、可以被任意其他类访问
D、只能被同一个类中的方法访问

单选题 下面哪个是合法的标识符( )

A、8down
B、$data
C、package
D、-code

单选题 下面语句不能编译成功的是( )

A、int b = 2.5;
B、double e = 3 + 4;
C、float g = 6.28f;
D、char d = 'B' + 2;