Ad
  • Custom User Avatar

    The initial solution setup uses a varargs parameter:

    public static String whoLikesIt(String... names) {
    

    and these can be called either as whoLikesIt("Alice", "Bob") or as whoLikesIt(new String[]{"Alice", "Bob"}). So if you just keep the varargs everything works.

  • Custom User Avatar

    For Java Users:
    U need replace tests with this:
    assertEquals("no one likes this", Solution.whoLikesIt(new String[] {}));
    assertEquals("Peter likes this", Solution.whoLikesIt(new String[] {"Peter"}));
    assertEquals("Jacob and Alex like this", Solution.whoLikesIt(new String[] {"Jacob", "Alex"}));
    assertEquals("Max, John and Mark like this", Solution.whoLikesIt(new String[] {"Max", "John", "Mark"}));
    assertEquals("Alex, Jacob and 2 others like this", Solution.whoLikesIt(new String[] {"Alex", "Jacob", "Mark", "Max"}));
    Or use overload of method.
    //Incorrectly specified input data for the task//

  • Custom User Avatar

    uhum... If variable name consist of one letter and using increment instead of operator += lead me to wrong results of tests 2 and 3? i look up the true answer and logic is the same as mine, but answer is wrong. i feel like i come back to jetbrains academy with them code checker.