Java tutorial
//package com.java2s; /** * @copyright Copyright (C) 2011 Asela Leelaratne * @license GNU/GPL Version 3 * * This Application is released to the public under the GNU General Public License. * * GNU/GPL V3 Extract. * 15. Disclaimer of Warranty. * THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. * EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES * PROVIDE THE PROGRAM AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE * PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL * NECESSARY SERVICING, REPAIR OR CORRECTION. */ public class Main { private static final String toInitialCap(String word) { if (word != null && word.length() > 1) { return String.valueOf(word.toUpperCase().charAt(0)) + word.substring(1).toLowerCase(); } return ""; } }