As per the requirement
7. The class must have an initialize method that takes a name as an argument, but initializes all variables except the address.
8. The class must have an initialize method that takes a name, weight, and age as arguments, but initializes all variables except the address.
9. The class must have an initialize method that takes a name and age as arguments, and initializes all variables except the address.
10. The class must have an initialize method that takes a weight and color as arguments, and initializes all variables except the name and address.
11. The class must have an initialize method that takes a weight, color, and address as arguments, but initializes all variables except the name.
there will be 2 methods with same type parameters such as :
public class Cat {
//write your code here
String name;
int weight, age;
String colour;
String address;
public static void main(String[] args) {
}
public void initialize(String name){
this.name = name;
weight = 10;
age = 10;
colour = "V";
}
public void initialize(String name, int weight, int age){
this.name = name;
this.weight = weight;
this.age = age;
colour = "V";
}
public void initialize(String name, int age){
this.name = name;
weight = 10;
this.age = age;
colour = "V";
}
public void initialize(String colour, int weight){
this.colour = colour;
this.weight = weight;
age = 10;
}
public void initialize(int weight, String colour, String address){
this.weight = 10;
age = 10;
this.colour = colour;
this.address = address;
}
}
Unable to understand what's wrong here ....?? error is as follows:
method initialize(java.lang.String,int) is already defined in class com.codegym.task.task05.task0510.Cat:
Cat.java, line: 40, column: 17
com/codegym/task/task05/task0510/Cat.java:40: error: method initialize(java.lang.String,int) is already defined in class com.codegym.task.task05.task0510.Cat
public void initialize(String colour, int weight){