make First Letter Upper Case - Java java.lang

Java examples for java.lang:String Case

Introduction

The following code shows how to make First Letter Upper Case.

Demo Code

//package com.java2s;

public class Main {
    public static void main(String[] argv) {
        String s = "java2s.com";
        System.out.println(makeFirstLetterUpperCase(s));
    }//from w w  w. j a v  a  2  s  .c  o m

    public static String makeFirstLetterUpperCase(String s) {
        return Character.toUpperCase(s.charAt(0)) + s.substring(1);
    }
}

Related Tutorials