【单选题】7.7若有下面的程序代码 public class Test{ long a[]=new long[10]; public static void main(String args[]){ System.out.println(a[6]); } } 哪一个选项是正确的()。
A.不输出任何内容
B.输出0
C.当编译时有错误出现
D.当运行时有错误出现
A.不输出任何内容
B.输出0
C.当编译时有错误出现
D.当运行时有错误出现
A、0
B、1
C、编译错误
D、运行错误
A、程序输出 null
B、程序输出 0
C、程序被编译,但在运行时将抛出一个ArrayIndexOutOfBoundsException异常
D、因为long[]数组声明不正确,程序不能被编译
A、common-gate
B、common-drain
C、common-source
D、None of the above
public class Sample{
long length;
public Sample(long 1){length=1;}
public static void main(String arg[]){
Sample s1,s2,s3;
s1=new Sample(21L);
s2=new Sample(21L);
s3=s2;
long m=21L;
}
}
下面表达式返回true的是______。
A.s1==s2; B.s2==s3;
C.m==s1;D.s1.equals(m);
A、A.public void throws IOException fun(){}
B、B.public void fun throws IOException(){}
C、C.public void fun()throws IOException{}
D、D.public void fun()throws IOException,throws SQLException{}
A、编译成功,输出为 true
B、编译成功,输出为 1
C、编译成功,输出为 false
D、编译成功,输出为 0
class AClass{
private long val;
public AClass(long v){val=v;}
public Static void main(String args[]){
AClass x=new AClass(10L);
AClass y=new AClass(10L);
AClass z=y;
long a=10L;
int b=10;
}
}
表达式正确的是______。
A.a==b; B.a==x; C.y==z;
D.X==y; E.a==10.0;
阅读下面求质数的程序 import java.lang.Math.*: public class MorePrimesTest { public static void main(String[] args) { long[] primes=new long[20]; primes[0]=2L; primes[0]=3L; long number=5L; outer: for(int count=2;count<primes.length;number+=2L) { long limit=(long)Math.ceil(Math.sqrt((double)number)); for(int i=1;i<count&&primes[i]<=limit;i++) { if(number primes[i]==OL)continue outer; } primes[count++]=number; } for(int J=0;j<primes.length;j++) { long n=primes[j]; System.out.println(n); } } } 程序下画线处应填入的正确选项是
A.&
B.*
C./
D.%
为了保护您的账号安全,请在“简答题”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!