Challenge 2 Java

Vì sao code ở đoạn 1 không lỗi, mà code ở đoạn 2 lại lỗi compilation error?

public class Bunny {
    private String type;
    private String color;

    public static void main(String[] args) {
        Bunny aBunny = new Bunny();
    }
}
public class Bunny {
    private String type;
    private String color;

    public Bunny(String type, String color) {
        this.type = type;
        this.color = color;
    }

    public static void main(String[] args) {
        Bunny aBunny = new Bunny(); // compilation error
    }
}

Bạn hãy comment câu trả lời của bạn và so sánh với solution ở page 2.

0 0 votes
Đánh giá challenge
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments