Working on this rookie task and need help.
This code must: Capitalize the first letter of the first word. Add a period (.) to the end of the sentence. Join the words into a complete string, with spaces. Do no other manipulation on the words.
Here is an example of what this code should do: INPUT "i", "am", "super", "HERO" OUTPUT I am super HERO.
I thought about this in that case:
import java.util.StringJoiner;
import java.lang.String;
public class My {
public static void main(String[] args) {
String[] arr = new String[]{"i", "am", "super", "HERO"};
StringJoiner sj = new StringJoiner(" ");
//StringBuffer sb = new StringBuffer(".");
for (String s : arr) {
sj.add(s);
}
sj.append(".");
sj.capitalize();
System.out.println(sj);
}
But catching error at "append" and "capitalize" - cannot resolve method. Pls, help.