更多"阅读下列程序,请写出该程序的输出结果。 public class C"的相关试题:
[简答题]
阅读下列程序,请写出该程序的输出结果。
public class A {
int m = 5;
static int n = 3;
public static void main(String[] args) {
A obj 1 = new A( );
A obj2 = new A( );
objl.m *= 2;
objl.n *= 4;
obj2.m += 1;
obj2.n += 6;
System.out.println("obj 1.m=’’ + obj 1.m);
System.out.println("obj 1.n=" + obj 1.n);
System.out.println("obj2.m=" + obj2.m);
System.out.println("obj2.n=" + obj2.n);
}
}
[简答题]
阅读下列程序,请写出该程序的输出结果。
class Test33 {
static int merger(int [] a, int []b, int []c){
int i = 0, j = 0, k = 0;
while(i < a.length && j < b.length) {
if(a[i] < b[j])c[k++] = a[i++];
else c[k++] = b[j++];
}
while(i < a.length) c[k++] = a[i++];
while(j < b.length) c[k++] = b[j++];
return k;
}
public static void main(String[] args) {
int a[] = {3, 6, 9};
int b[] = { 1, 2, 5};
int []c = new int[100];
int p = merger(a, b, c);
for(int k = 0; k < p; k++)
System.out.print(c[k]+ (k < p-1 " ":"/n"));
}
[填空题]阅读以下程序,请写出输出结果_________
public class EqualsMethod{
public static void main (String[]args){
Integer nl=new Integer (47):
Integer n2=new Integer (47);
System.out.println(n1.equals(n2));
}
[填空题]阅读以下程序,请写出输出结果_________ public class EqualsMethod public static void main (String[]args) Integer nl=new Integer (47): Integer n2=new Integer (47); System.out.println(n1.equals(n2));
[简答题]阅读下列程序,请写出程序的运行结果。
public class C
public static void main(String[] args)
String text="public static void main(String[] args)";
int theCount=0;
int index=-1;
String theStr="i";
index=text. indexOf(theStr);
while(index>=0)
++theCount;
index+=theStr. length( );
index=text. indexOf(theStr,index);
System. out. println("The Text contains"+theCount+"i");
[单项选择]
下列程序的输出结果是()。
public class fff
void printValue(int m)
do System.out.println("The value is" +m);
while( - - m > 10)
public static void main(String arg[ ] )
int i = 10;
Test t = new Test( );
t.printValue(i);
A. 8
B. 9
C. 10
D. 11
[单项选择]下面程序段的输出结果为 public class Test { int a, b; Test( ) { a=100; b=200; } Test(int x,int y) { a=x; b=y; } public static void main(String args[]) { Test Obj1=new Test(12,45); System.out.println("a=+Obj1.a+" b="+Obj1.B) ; Test Obj2=new Test( ); System.out.println("="+Obj2.a+" b="+Obj2.B) ; } }
A. a=100 b=200 a=12 b=45
B. a=12 b=45 a=100 b=200
C. a=12 b=200 a=100 b=45
D. a=100 b=45 a=12 b=200
[单项选择]下面程序段的输出结果为 public class Test { int a,b; Test( ) { a=100; b=200; } Test(int x,int y) { a=x; b=y; } public static void main(String args[]) { Test Objl=new Test(12,45); System.out.println("a="+objl.a+" b="+Objl.b); Test Obj2=new Test( ); System.out.println("a="+Obj2.a+" b="+Obj2.b); } }
A. a=100 b=200 a=12 b=45
B. a=12 b=45 a=100 b=200
C. a=12 b=200 a=100 b=45
D. a=100 b=45 a=12 b=200
[填空题]
请写出下面程序的运行结果:
public class Test extends TT{
public static void main(String args[]){
Test t=new Test("Tom.");
}
public Test(String s){
super(s);
System.out.print("How are you");
}
public Test( ){
this("I am Jack.");
}
}
class TT{
public TT( ){
System.out.print("Hi!");
}
public TT(String s){
this( );
System.out.print("I am"+s);
}
}
结果:()。
[单项选择]下面程序段的输出结果为
public class Test
int a,b;
Test( )
a=100;
b=200;
Test(int x,int y)
a=x;
b=y;
public static void main(String args[])
Test Objl=new Test(12,45);
System.out.println("a="+objl.a+" b="+Objl.b);
Test Obj2=new Test( );
System.out.println("a="+Obj2.a+" b="+Obj2.b);
A) a=100 b=200
a=12 b=45
B) a=12 b=45
a=100 b=200
C) a=12 b=200
a=100 b=45
D) a=100 b=45
a=12 b=200
[简答题]阅读以下程序代码,写出程序的输出结果。
public class Class35
public static void main(String[] args)
String s1=new String("0860371"),s2="0860371";
System. out. println(s1==s2);
System. out. println(s1. equals(s2));
System. out. println(s1. endsWith(s2)==s1. startsWith(s2));
[简答题]阅读以下程序代码,写出程序的输出结果。
public class Class32
public static void main(String[] args)
boolean x=true,y=false,z=false;
x=x&&y||z;
y=x||y&&z;
z=!(x!=y)||(y==z);
System. out. println(x+","+y+","+z);
[简答题]阅读以下程序代码,写出程序的输出结果。
public class Class33
public static void main(String[] args)
int a,b,c;
a=b=c=1;
boolean w;
w=a++>1&&++b>c++:
System. out. println(a+","+b+","+c+","+w);
[填空题]请写出下面程序的运行结果:
public class Test extends TT
public static void main(String args[])
Test t=new Test("Tom.");
public Test(String s)
super(s);
System.out.print("How are you");
public Test( )
this("I am Jack.");
class TT
public TT( )
System.out.print("Hi!");
public TT(String s)
this( );
System.out.print("I am"+s);
结果: 【15】 。