Компилятор ругается Error:(33, 21) java: method initialize(java.lang.String,int) is already defined in class com.javarush.task.task05.task0510.Cat и подчеркивает 3 и 4 инициализацию, как ошибку а 5 нет. где логика!!!!
package com.javarush.task.task05.task0510;
/*
Кошкоинициация
*/
public class Cat {
String name;
int height;
int age;
String color;
String addres;
public void initialize(String name){
this.name=name;
this.height=5;
this.age=3;
this.color="grey";
this.addres=null;
}
public void initialize(String name,int height, int age) {
this.name = name;
this.height = height;
this.age = age;
color = "grey";
this.addres=null;
}
public void initialize(String name,int age) {
this.name = name;
this.age=age;
this.height=5;
this.color="grey";
this.addres=null;
}
public void initialize(String color,int height) {
this.color=color;
this.height=height;
this.name=null;
this.age=10;
this.addres=null;
}
public void initialize(int height,String color,String addres) {
this.height=height;
this.color=color;
this.addres=addres;
this.age=10;
this.name=null;
}
public static void main(String[] args) {
}
}
package com.javarush.task.task05.task0510;
/*
Кошкоинициация
*/
public class Cat {
String name;
int height;
int age;
String color;
String addres;
public void initializing(String name){
this.name=name;
this.height=5;
this.age=3;
this.color="grey";
}
public void initializing(String name,int height, int age) {
this.name = name;
this.height = height;
this.age = age;
color = "grey";
this.addres=null;
}
public void initializing(String name,int age) {
this.name = name;
this.age=age;
this.height=5;
this.color="grey";
this.addres=null;
}
public void initializing(String color,int height) {
this.color=color;
this.height=height;
this.name=null;
this.age=10;
this.addres=null;
}
public void initializing(int height,String color,String addres) {
this.height=height;
this.color=color;
this.addres=addres;
this.age=10;
this.name=null;
}
public static void main(String[] args) {
}
}