A.Would you mind showing
D.Would you be showing
D.you to be
D.Would you mind to showing
第1题:
下列程序的输出结果是 classA{ int i,j; A(int i,int j) { this.i=i; this.j=j; } void print( ) { System.out.println("i="+i+""+"j="+j) } class B extends A{ int in; B (int i,int j,int m){ super(a,B) ; this.m=m; } void print( ) { Sytem.out.println("m+"+m);} } class C { public static void main (strang argsⅡ) { B b:new B(1,2,3); b.print( ); } }
A.i=1 j=2 m=3
B.m=3
C.i=3 j=2
D.m=1 i=1
第2题:
设有类定义如下:
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);
第3题:
第4题:
在下面附属类方法中的下划线处应填入的正确参数是( )。 public void writeData( ______ ) throws IOException{ GregorianCalendar calendar=new GregorianCalendar(); calendar.setTime(hireDay); out.println(name+"|"+salary+"|" +calendar.get(Calendar.YEAR)+"I" +(calendar.get(Calendar.MONTH)+1)+"|" +calendar.get(Calendar.DAY_OF_MONTH)); }
A.Employee[]e
B.employee.dat
C.PrintWriter out
D.BufferedWriter
第5题:
设有如下代码:
class Base{}
public class MyCast extends Base{
static boolean b1=false;
static int i = -1;
static double d = 10.1;
public static void main(String argv[]){
MyCast m = new MyCast();
Base b = new Base();
//Here
}
}
则在 //Here处插入哪个代码将不出现编译和运行错误。
A.b=m;
B.m=b;
C.d =i;
D.b1 =i;
第6题:
下面的代码用于输出字符数组ch中每个字符出现的次数,应该填入的代码是()public static void main(String[] args) { char[] ch = { 'a', 'c', 'a', 'b', 'c', 'b' }; HashMap map = new HashMap(); for (int i = 0; i < ch.length; i++) { < 填入代码 > } System.out.println(map); }
A.if (map.contains(ch[i])) { map.put(ch[i], map.get(ch[i]) + 1); } else { map.put(ch[i], 1); }
B.if (map.contains(ch[i])) { map.put(ch[i], (Integer) map.get(ch[i]) + 1); } else { map.put(ch[i], 1); }
C.if (map.containsKey(ch[i])) { map.put(ch[i], (int) map.get(ch[i]) + 1); } else { map.put(ch[i], 1); }
D.if (map.containsKey(ch[i])) { map.put(ch[i], (Integer) map.get(ch[i]) + 1); } else { map.put(ch[i], 1); }