Java String camel case
public class Main { public static void main(String[] args) { String str = "have a nice day"; String[] str1 = str.split(" "); String ans = ""; for (int i = 0; i < str1.length; i++) { if (i != 0) { char ch = str1[i].charAt(0); ch = (char) (ch - 32); str1[i] = ch + str1[i].substring(1, str1[i].length()); }/*from ww w . j a v a2 s . co m*/ ans += str1[i]; } System.out.println(ans); } }