Java tutorial
public class Main { public static void main(String[] args) { String s = "this is a test"; System.out.println(capitalize(s)); } public static String capitalize(String s) { if (s.length() == 0) { return s; } return s.substring(0, 1).toUpperCase() + s.substring(1).toLowerCase(); } }