奥鹏远程教育北京语言大学《Java语言程序设计》在线作业一

奥鹏教育北京语言大学平时在线作业

20春《Java语言程序设计》作业1

下面程序段的输出结果是_______。public class Test{
public static void main(String args[]){
int x,y;
x=(int)Math.sqrt(5)/2+(int)Math.random()*5/2;
y=(int)Math.sqrt(3)/2+(int)Math.random()*3/2;
if(xy)
System.out.println("xy");
A:xy
B:x=y
C:xy
D:编译错误
答案问询微信:424329

下列程序段不正确的是_______。
A:String A="firstJava";A-="Java";
B:String A="firstJava";A+="Java";
C:Integer J=new Integer(27);J-=7;
D:Integer J=new Int奥鹏教育北京语言大学平时在线作业eger(27);J–;
答案问询微信:424329

下面程序段的输出结果为_______。public class NewClass {
public static void main(String args[]){
int x,y;
x=(int)82.5;
y=(int)'A';
System.out.print("x="+x);
System.out.print("ty="+y);
}
}
A:82.5 A
B:82 A
C:82.5 65
D:82 65
答案问询微信:424329

下列选项中不属于Java核心包的一项是_______。
A:javax.naming
B:javax.rmi
C:javax.sound
D:java.math
答案问询微信:424329

执行下列程序段,请选出正确的答案。public class Test{
public static void throwit(){
throw new RuntimeException();
}
public static void main(String args[]){
try{
System.out.println("你好吗");
throwit();
System.out.pri
A:不能通过编译
B:输出“你好吗”→RuntimeException异常发生→输出“出错!”→输出“结束”
C:输出“你好吗”→RuntimeException异常发生→输出“结束”
D:输出“你好吗”→输出“结束”→RuntimeException异常发生
答案问询微信:424329

下面不属于Java语句的基本数据类型的是_______。
A:浮点型
B:整型
C:字符型
D:数组型
答案问询微信:424329

下面程序段的输出结果为public class Test {

public static void main(String args[]){

int a[]={1,2,3},b[]=new int [3];

System.arraycopy(a, 0, b, 0, 3);

System.out.println("a[0]="+a[0]+" b[0]="+b[0]);

a[0]=10;

System.out.println("a
A:a[0]=1 b[0]=1 a[0]=10 b[0]=1
B:a[0]=10 b[0]=1 a[0]=10 b[0]=1
C:a[0]=1 b[0]=10 a[0]=1 b[0]=10
D:a[0]=10 b[0]=10 a[0]=1 b[0]=1
答案问询微信:424329

下面程序段的输出结果为_______。class OverMethod{
void printMeth(){
System.out.println("There is none parameter.");
}
void printMeth(String t){
System.out.println("There is one parameter.");
}
void printMe
A:There is none parameter.There is one parameter.There are two parameters.
B:There is one parameter.There is none parameter.There are two parameters.
C:It’s good!There is none parameter.There are two parameters.
D:There is none parameter.It’s good!There are tw
答案问询微信:424329

如果在编译Java程序时,编译结果报告说找不到编译的代码,下列哪一项不是常见的错误?
A:没有import相应的包
B:文件名拼写错误
C:未加.java后缀
D:源文件不在当前目录下
答案问询微信:424329

下面程序段的输出结果为_______。public class Test {
public static void main(String args[]){
char c1,c2,c3;
c1='H';
c2='\';
c3='115';
System.out.print(c1);
System.out.print(c2);
System.out.print(c3);
A:HM
B:H\115
C:H115
D:无输出
答案问询微信:424329

提供优质的教育资源

公众号: 超前自学网