在Java语言中,下列语句能通过编译的是()。
第1题:
给出下列的不完整的类代码,则哪个语句可以被加到横线处? ( ) class Person{ String name,department; int age; public Person(String n){name=n;} public Person(String n,int s){name=n; age=a;} public Person(String n,String d,int a){ department=d;______ } }
A.Person(n,a);
B.this(Person(n,a));
C.this(n,s);
D.this(name,age);
第2题:
下列程序段运行的结果为 public class Test{ static void print(String s,int i){ System.out.println("String:"+s+",int:"+i); } static void print(int i, String s){ System.out.println("int:"+i+",String:"+s); } public static void main(String [] args){ print(99,"Int first"); } }
A.String:Stringfirst,int:11
B.int:11,String:Int first
C.String:String first,int:99
D.int:99,String:int first
第3题:
下列代码的执行结果是( )。 public class Test { public static void main (String args[]) { int a=3,b=5,c=8; String s="abc"; System.out.println(a+b+s+c); } }
A.35abc8
B.8abc8
C.16
D.abc
第4题:
下列合法的数组定义是______。
A.int a[]="string";
B.int a[5]={0,1,2,3,4,5};
C.char s="string";
D.char a[]={0,1,2,3,4,5};
第5题:
3下列程序段运行的结果为( )。 public class Test{ static void print(String s,int i){ System.out.pdntlnC String: "+s+",int:"+i); } static void print(iht i,String s){ System.out.prinflnCint:"+i+",gtring:"+s); } public static void main(String[] args){ print(99,"Int first"); } }
A.String:String first,int: 11
B.int: 11,String:Int first
C.String:String first,int:99
D. int:99,Stfing:Int first
第6题:
下面哪个语句是正确的()
第7题:
下列不是 String 类的方法的是()
第8题:
设有定义:String s=“World”;,下列语句错误的是()。
第9题:
在PowerScript语言中,下列定义正确的数组包括()。
第10题:
有语句String s=”hello world”; ,以下操作哪个是不合法的()
第11题:
Strings=john+was+here;
Strings=john+3;
floatf=5+5.5;
inta=3+5;
第12题:
String s = john + was + here;
String s = john + 3;
int a = 3 + 5;
int a = 5 + 5.5;
第13题:
在PowerScript语言中,下列定义正确的数组包括()
A. Int A[]
B. String S[5]
C. Int N[2 to 8, 3 to 6]
D. Real R[6 to 3]
第14题:
下面程序代码运行结果为( )。 import java.awt.*; public class Test { public static void main (String args[]) { String s1="a+b+c"; String s2="+"; int i=s1.lastIndexOf (s2); System.out.println(i); } }
A.0
B.1
C.2
D.3
第15题:
为了从HTML文件中获取参数,在Applet程序中应该编写的代码是( )。
A.在start()方法中加入语句String s=getParameter("buttonLabel");
B.在int()方法中加入语句String s=Parameter("buttonLabel");
C.在int()方法中加入语句String s=getParameter("BUTTONLABEL");
D.在start()方法中加入语句String s=getParameter("BUTIONLABEL");
第16题:
下面的表达式中正确的是 ( )
A.String s=“你好”;int i=3;s+=i;
B.String s=“你好”;int i=3;if(i==s){s+=i};
C.String s=“你好”;int i=3;s=i+s;
D.String s=“你好”;int i=3; s=i+;
第17题:
设有类定义如下:
class InOut{
String s= new String("Between");
public void amethod(final int iArgs){
int iam;
class Bicycle{
public void sayHello(){
//Here
}
}
}
public void another(){
int iOther;
}
}
以下哪些语句可以安排在//Here处 ?
A. System.out.println(s);
B.System.out.println(iOther);
C. System.out.println(iam);
D. System.out.println(iArgs);
第18题:
在java中,下列()语句不能通过编译。
第19题:
下面哪些语句能够正确地生成5个空字符串?()
第20题:
下面关于数组声明和初始化的语句哪个有语法错误()
第21题:
合法的数组定义是()
第22题:
已知Strings=“Java”,则下面哪些代码是正确的()
第23题:
charAt(int index)
indexOf(String s)
beginWith(String s)
endsWith(String s)