public class Student { private String name ; private double achv; public String getName() { return name; } public void setName(String name) { this.name = name; } public double getAchv() { return achv; } public void setAchv(double achv) { this.achv = achv; } Student(){ } Student(String name,double achv){ this.achv=achv; this.name=name; } }
public class Person { public Person() { System.out.println("无参的构造方法被调用了..."); } } package fff; public class fff { public static void main(String[] args) { Person p1 = new Person(); } }
public class fff { private String name; private String color; public void run(){ System.out.println("车跑的很快"); } public Car() { } public Car(String name, String color) { this.name = name; this.color = color; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getColor() { return color; } public void setColor(String color) { this.color = color; } }