Lines should always be within the "and". So your code will be
System.out.println("The three initials are " +
getInitials("Harry", "Joseph", "Hacker"));
In addition, you can also use
String initials = one.charAt(0)+two.charAt(0)+three.charAt(0);
in your getInitials () function instead
String initials = one.substring(0,1) + two.substring(0,1) + three.substring(0,1);
Just saying it. Both give you a character at the 0th position of the index in String, but charAt returns as a character, not as a string.
source
share