Skip to content

Instantly share code, notes, and snippets.

@kryvoboker
Created May 29, 2020 19:51
Show Gist options
  • Save kryvoboker/686f1fad8df8d19e27ddac9bec7316de to your computer and use it in GitHub Desktop.
Save kryvoboker/686f1fad8df8d19e27ddac9bec7316de to your computer and use it in GitHub Desktop.
public class Main {
public static void main(String[] args) {
Cat catOne = new Cat();
catOne.setColor("Black");
catOne.setName("Murzik");
catOne.setSex("He");
catOne.setType("Dvorovoi");
catOne.setYear(12);
System.out.println(catOne);
System.out.println();
Cat catTwo = new Cat();
catTwo.setColor("Red");
catTwo.setName("Shashlyk");
catTwo.setSex("He");
catTwo.setType("Britanec");
catTwo.setYear(1);
System.out.println(catTwo);
System.out.println();
Cat catThree = new Cat();
catThree.setColor("White");
catThree.setName("Djulieta");
catThree.setSex("She");
catThree.setType("Sfinks");
catThree.setYear(3);
System.out.println(catThree);
}
}
public class Cat {
private String color;
private int year;
private String name;
private String type;
private String sex;
public Cat(String color, int year, String name, String type, String sex) {
this.color = color;
this.year = year;
this.name = name;
this.type = type;
this.sex = sex;
}
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
public int getYear() {
return year;
}
public void setYear(int year) {
this.year = year;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
public Cat() {
super();
}
@Override
public String toString() {
return "Cat{" + "color=" + color + ", year=" + year + ", name=" + name + ", type=" + type + ", sex=" + sex + '}';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment