Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Animal {
- private String name;
- private int age;
- private String color;
- public Animal() {
- name = "Dog";
- age = 2;
- color = "brown";
- }
- public Animal(String n, int a, String c) {
- name = n;
- age = a;
- color = c;
- }
- public String toString() {
- return "Name: " + name + ", Age: " + age + ", Color: " + color + ".";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement