I am trying to get an account with Codewars and was surprised that you should show them that you have basic knowledge in one of the proposed programming languages. I chose Java, but stuck in one exercise. Code:
public class Person { String name; public Person(String personName) { name = personName; } public String greet(String yourName) { return String.format("Hi %s, my name is %s", yourName, name); } }
It says: "Correct this code so that the greet function returns the expected value." The fact is that I do not see an error, and in fact I copied the code in Eclipse and after changing the Java compiler and using version 1.6, the code works, there is no error, and if you try it using the main method, it returns the expected value.
If only they tell you what the expected value is ... When sending, no matter what I try, I always get "The code does not work as expected."
Any ideas?
source share