public abstract class A
{
public A()
{
C.onsole.WriteLine('A');
}
public virtual void Fun()
{
C.onsole.WriteLine("A.Fun()");
}
}
public class B: A
{
public B()
{
C.onsole.WriteLine('B');
}
public new void Fun()
{
C.onsole.WriteLine("B.Fun()");
}
public static void Main()
{
A. a = new B();
a.Fun();
}
}
[主观题]写出程序的输出结果public abstract class A{public A(){C.onsole.WriteLine('A');}public virtual void Fun(){C.onsole.WriteLine("A.Fun()");}}public class B: A{public B(){C.onsole.WriteLine('B');}public new void Fun(){C.onsole.WriteLine("B.Fun()");}public s
[主观题]写出程序的输出结果:public class A{public virtual void Fun1(int i){C.onsole.WriteLine(i);}public void Fun2(A a){a.Fun1(1);F.un1(5);}}public class B : A{public override void Fun1(int i){base.Fun1 (i + 1);}public static void Main(){B. b = new B();A. a = new A();
[单选题]执行下列程序后,输出结果为( )。 public class Test { public static void main (String[] args) { StringBuffer sb = new StringBuffer("北京 2008" ); System. out. println ("length =" + sb. length ( ) ); } }A.length = 8B.length = 10C.length = 6D.length = 20
[单选题]下面程序输出的结果是什么? ( ) public class Quiz2 { public static void main(String args[]) { try {throw new MyException(); }catch(Exception e) { System.out.println("It's caught!"); }finally{ System.out.println("It's finally caught!"); } } } class MyExceptio
[单选题]写出下面程序的输出( )。 public class Test { public static void main (String args[ ]) { iht x=1, y=2; System. out. println ("result="+x+y); System. out. println ("result="+(x+y));A.result=12 result=12B.result=3 result=3C.result=3 result=12D.result=12 result
[主观题]写出程序运行的结果Public class BasePublic virtual string Hello() {return “Base”;}Public class Sub:BasePublic override string Hello() {return “Sub”;}1. Base b = new Base(); b.Hello;2. Sub s = new Sub(); s.Hello;3. Base b = new Sub (); b.Hello;4. Sub s = new Ba
[单选题]下面程序片段的运行结果是( )。 public class Test { public static void main (String args[]) { int a=10,b=4,c=20,d=6; System.out.println (a++ *b+c* --d); } }A.144B.160C.140D.164
[单选题]下列程序输出结果为( )。 public class test { public static void main (String args[]) { int a=0; outer:for(int i=0;i<2;i + +) { for(int j=0;j<2;j+ +) { if(j>i) { continue outer; } a+ +; } } System.out.println(a); } }A.0B.2C.3D.4
[单选题]下列程序的输出结果为( )。 public class Test { public static void main (String[] args) { int i,j,k,a=3,b=2; i=(--a==b++)? --a:++b; j=a++; k=b; System. out. println("i="+i+" ,j =" +j+",k ="+k); } }A.i=2, j=1, k=3B.i=1, j=1, k=2C.i=4, j=2, k=4D.i=1, j=1, k=3
[单选题]下列程序输出的结果为( )。 public class Test { public static void main (String[] args){ int a=3,b=4,c=5,d=6,e=7; if(a<b||c>d)e++; else e--; System.out.println(e); } }A.8B.7C.6D.9