Java 易错笔试题

CVTE2014
package com.sumiplus.example;

public class ABCD {

	/**
	 * @param args
	 */
	static class A {
		public void N() {
			System.out.print("A");
		}
	}

	static class B extends A {
		public void N() {
			System.out.print("B");
		}
	}

	static class C extends B {
		public  static void N2() {
			System.out.print("C");
		}
	}

	 static class D extends C {
		public static void N2() {
			System.out.print("D");
		}
	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		D d = new D();
		C c = d;
		B b = c;
		A a = b;
		d.N2();
		c.N2();
		b.N();
		a.N();

	}

}
答案:DCBB

你可能感兴趣的:(Java 易错笔试题)