标签:java ges main 实践 mat ack int load fine
记录下面试里面遇到的一些java盲区,一方面扫描自己的知识盲区,一方面也可以给后面面试的朋友一些警示,以免面试的时候出现不知道的尴尬情况。
初步设计类的结构uml。
直接上源代码
/**
* 轮子类
*/
public class Wheel {
public Wheel(String name){
System.out.println(name);
}
}
//汽车
public class Car {
static Wheel backWheel = new Wheel("static: Car => backWheel");
Wheel forwordWheel = new Wheel("Car => forwordWheel");
Car(){
System.out.println("Car");
}
}
//奔驰汽车
public class BenzCar extends Car{
static Wheel backWheel = new Wheel("static: BenzCar = > backWheel");
Wheel forwordWheel = new Wheel("forwordWheel = >");
BenzCar(){
System.out.println("BenzCar");
}
}
//测试类
public class Main {
public static void main(String[] args) {
System.out.println("====================>");
BenzCar benzCar = new BenzCar();
System.out.println("====================>");
}
}
输出结果:有点出乎意料。
====================>
static: Car => backWheel
static: BenzCar = > backWheel
Car => forwordWheel
Car
forwordWheel = >
BenzCar
====================>
java学习群669823128
标签:java ges main 实践 mat ack int load fine
原文地址:http://www.cnblogs.com/rese-t/p/7840521.html