反射(二)
反射(二) 通过栗子来更好的理解反射,以及对反射技术进行应用。 首先,整两个model——car.java和Benz.java public class Car { public String type; private String color; public static void drive(){ System.out.println("The car is driving"); } } public class Benz extends Car { public String brand; private String model; private int sale; public static String text; public Benz() { } private Benz(String brand) { this.brand = brand; } public Benz(String brand, String model) { this.brand = brand; this.model = model; } public int getSale() { return sale; } public String getBrand() { return brand; } public static void desc(){ System.out.println(