举一反三
- 下面程序的输出结果是: class Myclass{ static int member; } public class Test{ public static void main(String args[]){ Myclass A = new Myclass(); Myclass B = new Myclass(); Myclass.member = 1; A.member = 2; B.member = 3; System.out.println("member = "+ Myclass.member); } }
- 下面程序运行结果为___________________。public class MyClass{ private static int a = 19; public static void modify(int a){ a = a + 5;} public static void main(String[] args){ modify(a); System.out.println(a); }}
- 以下代码的输出结果?public class Test{static int...ge(int m){m+=2;}}
- 请写出下列程序的输出结果。class A{public int f(int x) {return x+1;}}class B extends A{public int f(int x){return x*x;}}public class E{public static void main(String args[]){A a=new B();int m=a.f(10);System. out. println(m) ;}}
- 下列代码的输出结果是( )interface Com{ int M=100; int on();}class A implements Com{ public int on(){ return Com.M; }}public class E{ public static void main(String args[]){ Com com=new A(); int m=com.on(); System.out.println(m); }}
内容
- 0
关于下列程序段的输出结果,说法正确的是:()public class MyClass{static int i;public static v A: A.有错误,变量i没有初始化。 B: B.null C: C.1 D: D.0
- 1
下面程序段对应的输出结果是?public class Test5 {publ...em.out.print(m);}}
- 2
判断C#类MyClass的定义中哪些定义是合法的抽象类 A: abstract class Myclass{ abstract int getCount();} B: private abstract class Myclass{ abstract int getCount();} C: abstract class Myclass{ public abstract int getCount();} D: sealed abstract class Myclass{ abstract int getCount();}
- 3
下面哪个对类的声明是错误的 A: public class MyClass{} B: private class MyClass {} C: class MyClass extends MySuperClass1, MySupperClass2 {} D: class MyClass extends MySuperClass
- 4
分析下列程序中类MyClass的定义 class BaseClass { public int i; } class MyClass:BaseClass { public new int i; } 则下列语句在Console 上的输出为【 】。 MyClass y = new MyClass(); BaseClass x = y; x.i = 100; Console.WriteLine("{0}, {1}",x.i,y.i);