网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

publicclassYikes{publicstaticvoidgo(Longn){System.out.println(”Long);}publicstaticvoidgo(Shortn){System.out.println(”Short);}publicstaticvoidgo(intn){System.out.println(”int);}publicstaticvoidmain(String[]args){shorty=6;longz=7;go(y);go(z);}}Whatistheresult?()

A.intLong

B.ShortLong

C.Compilationfails.

D.Anexceptionisthrownatruntime.


参考答案

更多 “ publicclassYikes{publicstaticvoidgo(Longn){System.out.println(”Long);}publicstaticvoidgo(Shortn){System.out.println(”Short);}publicstaticvoidgo(intn){System.out.println(”int);}publicstaticvoidmain(String[]args){shorty=6;longz=7;go(y);go(z);}}Whatistheresult?()A.intLongB.ShortLongC.Compilationfails.D.Anexceptionisthrownatruntime. ” 相关考题
考题 若给fun函数的形参s传送字符串:"]]6354abcc" (其中]表示空格字符),则函数的返回值是【19】。#include ctype.hlong fun(char s[]){long n;int sign;for(;isspace(*s);s++);sign=(*s==′-′)?-1:1;if(*s==′+′||*s==′-′)s++;for(n=0;isdigit(*s);s++)n=10*n+(*s-′0′);return sign*n;}

考题 publicclassWow{publicstaticvoidgo(shortn){System.out.println(”short”);}publicstaticvoidgo(Shortn){System.out.println(”SHORT”);}publicstaticvoidgo(Longn){System.out.println(”LONG”);}publicstaticvoidmain(String[]args){Shorty=6;intz=7;go(y);go(z);}}Whatistheresult?()A.shortLONGB.SHORTLONGC.Compilationfails.D.Anexceptionisthrownatruntime.

考题 switch(x){default:System.out.println(“Hello”);}Whichtwoareacceptabletypesforx?() A.byteB.longC.charD.floatE.ShortF.Long

考题 阅读下面求质数的程序 import java. lang. Math. * ; public class MorePrimesTest{ public static void main(String[]args){ long[]primes=new long[20]; primes[0]2L; primes[1]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]==0L){ cotinue outer; } } for(int j=0; j<primes. length; j ++){ long n=primes[j]; System. out. println(n); } } } 在程序下画线处填入的正确选项是A.B.*C./D.%

考题 若给fun函数的形参s传送字符串:"abc-6354abc",则函数的返回值是( )。(字符串中包括空格)long fun(char S[]){long n;int sign;for(;isspace(*s)||islower(*s);s++);sign=(*s=='-')?-1:1;if(*s=='+'||*s=='-')s++;for(n=0;isdigit(*s);s++)n=10*n+(*S-'0');return sign*n;}

考题 阅读下面求质数的程序 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<countprimes[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.%

考题 以下代码中变量result的可能类型有哪些?byte b = 11;short s = 13;result = b * ++s; A.byte, short, int, long, float, doubleB.boolean, byte, short, char, int, long, float, doubleC.byte, short, char, int, long, float, doubleD.byte, short, charE.int, long, float, double

考题 9、请阅读下面的代码 String s1=new String(“abc”); String s2=s1.intern(); String s3=”abc”; System.out.println(s1==s2); System.out.println(s2==s3); System.out.println(s1==s3); 下列选项中,程序的输出结果为()A.false true falseB.false false falseC.false true trueD.false false true

考题 执行完1题的三行代码后,接着执行下面的三行代码: System.out.println(s == s1); System.out.println(s == s2); System.out.println(s1 == s2); 输出的结果是:()A.true true trueB.false false trueC.false fasle falseD.true true false