What is wrong with this code (or the validator??). Maybe I misunderstood the challenge? The code complies with all requirements, including the last one. Nevertheless the validator tells me, it does not fullfill the last requirement: "The Cat class's setName method must set the value of the global private String variable fullName equal to the local variable fullName."
package com.codegym.task.task04.task0406;
/*
Name register
Finish writing the code of the setName method so that it sets the value of
private String fullName to the value of the local String variable fullName.
*/
public class Cat {
private String fullName;
public void setName(String firstName, String lastName) {
String fullName = this.fullName;
fullName = firstName + " " + lastName;
System.out.println(fullName);
}
public static void main(String[] args) {
Cat fullName = new Cat ();
fullName.setName("John", "Doe");
}
}