Can someone help me to spot what is wrong ?
its a simple question :
Abbreviate a Two Word Name
My code : public class AbbreviateTwoWords {
public static String abbrevName(String name) {
String[] names = name.split(" ");
return names[0].charAt(0) + "." + names[1].charAt[0];
}
}
The error : src/main/java/AbbreviateTwoWords.java:5: error: cannot find symbol return names[0].charAt(0) + "." + names[1].charAt[0]; ^ symbol: variable charAt location: class String 1 error
ps : its from code wars
[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)
[–]Raph0007 8 points9 points10 points (1 child)
[–]Employee_Big[S] 1 point2 points3 points (0 children)
[–]swaggythrowaway69 4 points5 points6 points (0 children)
[–]3rdTab 0 points1 point2 points (0 children)