upper Case string and handle null value - Java java.lang

Java examples for java.lang:String Case

Description

upper Case string and handle null value

Demo Code

import java.util.ArrayList;
import java.util.List;

public class Main{

    public static void main(String[] argv){
        String str = "java2s.com";
        System.out.println(upperCase(str));
    }//w w w.j  av a  2s  . c o  m
    public static String upperCase(String str) {
        if (str == null) {
            return null;
        }
        return str.toUpperCase();
    }

}

Related Tutorials