网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
下列代码的执行结果是( )。 int length=”Hello”.length( ); System.OUt.println(length);
A.5
B.2
C.10
D.6
参考答案
更多 “ 下列代码的执行结果是( )。 int length=”Hello”.length( ); System.OUt.println(length);A.5B.2C.10D.6 ” 相关考题
考题
下列代码的执行结果是______。Int length="Hello", length();System.out.println(lenght);A) 5B) 2C) 10D) 6A.B.C.D.
考题
int型public成员变量MAX_LENGTH,该值保持为常数100,则定义这个变量的语句是 ( )。A.public int MAX_LENGTH=100B.fmal int MAX_LENGTH=100C.pubic const int MAX_LENGTH=100D.public final int MAX_LENGTH=100
考题
Whichcodefragmentswillsucceedinprintingthelastargumentgivenonthecommandlinetothestandardoutput,andexitgracefullywithnooutputifnoargumentsaregiven?()CODEFRAGMENTa:publicstaticvoidmain(Stringargs[]){if(args.length!=0)System.out.println(args[args.length-1]);}CODEFRAGMENTb:publicstaticvoidmain(Stringargs[]){try{System.out.println(args[args.length]);}catch(ArrayIndexOutOfBoundsExceptione){}}CODEFRAGMENTc:publicstaticvoidmain(Stringargs[]){intix=args.length;Stringlast=args[ix];if(ix!=0)System.out.println(last);}CODEFRAGMENTd:publicstaticvoidmain(Stringargs[]){intix=args.length-1;if(ix0)System.out.println(args[ix]);}CODEFRAGMENTe:publicstaticvoidmain(Stringargs[]){try{System.out.println(args[args.length-1]);}catch(NullPointerExceptione){}}
考题
阅读下面代码 public class Arrays { public static void main(String[] args) { int[] a=new int[5]; for(int i=0;i<a.length;i=i+1)a[i]=10+i; for(int i=0;i<a.length;i=i+1)System.out.println(a[i]); String[] s={"Frank","Bob","Jim"}; for(int i=0;i<s.length;i=i+1)System.out.println(s[i]); s[2]="Mike"; System.out.println(s[2]); } } 代码运行正确的结果是A.10 11 12 13 14 Mike Bob Frank JimB.11 12 13 14 15 Frank Bob Mike JimC.10 11 12 13 14 Frank Bob Jim MikeD.11 12 13 14 15 Mike Jim Bob Frank
考题
设有数组定义:int a[ ]={11,22,33,44,55,66,77,88,99};则执行下列几条语句后的输出结果是 ______。for(int i=0;i<a.length;i++)if(a[i]%3==0)System.out.println(a[i]+" ");
考题
分析以下代码,完成填空string strTmp = "abcdefg某某某";int i= System.Text.Encoding.Default.GetBytes(strTmp).Length;int j= strTmp.Length;以上代码执行完后,i= j=
考题
执行下面代码后:String strTemp =”abcdefg 某某某”;Int i System.Text.Encoding.Default.GetBytes(strTemp).Length;Int j = strTemp.Length;问:i=(14 ) ;j=(11 )
考题
下列代码的执行结果是( )。 int length="Hell0".length; System.OUt.println(length); A.5S
下列代码的执行结果是( )。 int length="Hell0".length; System.OUt.println(length);A.5B.2C.10D.6
考题
在下面程序运行includeint func(char s[]){ int length=0; while(*(s+length))leng
在下面程序运行 #include<iostream.h> int func(char s[]){ int length=0; while(*(s+length))length++; return length; } void main(){ char a[10], *ptr=a; cin>>ptr; cout<<fune(ptr)<<end1; } 如果输入字符串Hello!并回车,则输出结果为 ______。A.4B.7C.6D.5
考题
以下( )表达式是不合法的。A.string x="hello";int y=9;x+=y;B.string x="hello";int y=9;if(x=y){}C.string x="hello";int y=9;x=x+y;D.string x=null;inty=(x!=null)(x.length()>0)?x.length():0;
考题
设有数组定义:int a[ ] = { 11 , 22 , 33 , 44 , 55 , 66 , 77 , 88 , 99 }; 则执行以下几个语句后的输出结果是 ()、() 、() 。 for ( int i = 0 ; i a.length ; i ++ ) if ( a[i]%3==0 ) System.out.println(a[i]);
考题
int型public成员变量MAX_LENGTH,该值保持为常数100,则定义这个变量的语句是()A、public int MAX_LENGTH=100B、final int MAX_LENGTH=100C、public const int MAX_LENGTH=100D、public final int MAX_LENGTH=100
考题
执行代码Strings=newString("Hello")后,正确的结论是()A、s最后一个索引值为5B、s的值和"Hello"并不一样C、s.length为4D、s.length为5
考题
单选题Which code fragments will succeed in printing the last argument given on the command line to the standard output, and exit gracefully with no output if no arguments are given?() CODE FRAGMENT a: public static void main(String args[]) { if (args.length != 0) System.out.println(args[args.length-1]); } CODE FRAGMENT b: public static void main(String args[]) { try { System.out.println(args[args.length]); } catch (ArrayIndexOutOfBoundsException e) {} } CODE FRAGMENT c: public static void main(String args[]) { int ix = args.length; String last = args[ix]; if (ix != 0) System.out.println(last); } CODE FRAGMENT d: public static void main(String args[]) { int ix = args.length-1; if (ix 0) System.out.println(args[ix]); } CODE FRAGMENT e: public static void main(String args[]) { try { System.out.println(args[args.length-1]); }catch (NullPointerException e) {} }A
Code fragment a.B
Code fragment b.C
Code fragment c.D
Code fragment d.E
Code fragment e.
考题
单选题MAX_LENGTH是int型public成员变量,变量值保持为常量100,其定义是()。A
final public int MAX_LENGTH=100;B
public int MAX_LENGTH=100;C
public final int MAX_LENGTH=100;D
final int MAX_LENGTH=100;
考题
填空题设有数组定义:int a[ ] = { 11 , 22 , 33 , 44 , 55 , 66 , 77 , 88 , 99 }; 则执行以下几个语句后的输出结果是 ()、() 、() 。 for ( int i = 0 ; i a.length ; i ++ ) if ( a[i]%3==0 ) System.out.println(a[i]);
考题
单选题A public member vairable called MAX_LENGTH which is int type, the value of the variable remains constant value 100. Use a short statement to define the variable.()A
public int MAX_LENGTH=100;B
final int MAX_LENGTH=100;C
final public int MAX_LENGTH=100;D
public final int MAX_LENGTH=100;
考题
单选题执行代码Strings=newString("Hello")后,正确的结论是()A
s最后一个索引值为5B
s的值和Hello并不一样C
s.length为4D
s.length为5
考题
多选题MAX_LENGTH是int型public成员变量, 变量值保持为常量100,用简短语句定义这个变量。()Apublic int MAX_LENGTH=100;Bfinal int MAX_LENGTH=100;Cfinal public int MAX_LENGTH=100;Dpublic final int MAX_LENGTH=100.
热门标签
最新试卷