Write code to Capitalize the first letter in the passed string
//package com.book2s; public class Main { public static void main(String[] argv) { String cs = "book2s.com"; System.out.println(initCap(cs)); }/*w w w . j ava 2s .c o m*/ /** * Caps the first letter in the passed string * @param cs The string value to initcap * @return the initcapped string */ public static String initCap(CharSequence cs) { char[] chars = cs.toString().trim().toCharArray(); chars[0] = new String(new char[] { chars[0] }).toUpperCase() .charAt(0); return new String(chars); } }