更多"阅读下列程序,写出程序运行结果。 public class C330"的相关试题:
[简答题]阅读下列程序,请写出程序的运行结果。
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");
[简答题]阅读下列程序,写出程序运行结果。
class A1
public void f(int aa,int bb)
System.out.println(aa+bb);
class A2 extends A1
public void f(int aa,int bb)
System. out. println(aa-bb);
public class C3201 extends A2
public void f(int aa,int bb)
System. out. println(aa*bb);
public static void main(String[] args)
A1 a=new Al( );
A1 a1=new A2( );
A2 a2=new C3201( );
a.f(20,10);
a1.f(20,10);
a2.f(20,10);
[填空题]
请写出下面程序的运行结果:
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 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(SUing 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】 。
[填空题]请写出下面程序的运行结果:
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 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 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 Class34
public static void main(String[] args)
int a=1,b;
while(a<=9)
b=1;
while(b<=a)
System. out. print(" "+a+"×"+b+"="+a*b);
b++;
System. out. println( );
a++;
[简答题]阅读下列程序,请写出该程序的输出结果。
public class C
int x=10;
static int y=20;
public static void main(String[] args)
C obj1=new C( );
C obj2=new C( );
obj1.x*=2;
obj1.y*=3;
obj2.x+=4;
obj2.y+=5;
System. out. println(obj1.x);
System. out. println(obj1.y);
System. out. println(obj2.x);
System. out. println(obj2.y);