Friday, 13 April 2018

String to UpperCase example



  1. /*
            Java String to Upper Case example.
            This Java String to Upper Case example shows how to change the string to upper case
            using toUpperCase method of String class.
    */

    public class StringToUpperCaseExample  
    {

            public static void main(String[] args)  
    {

                    String str = “string touppercase example”;

                    /*
                     * To change the case of string to upper case use,
                     * public String toUpperCase() method of String class.
                     *
                     */

                     String strUpper = str.toUpperCase();

                     System.out.println(“Original String: “ + str);
                     System.out.println(“String changed to upper case: “ + strUpper);
            }
    }

    /*
    Output would be
    Original String: string touppercase example
    String changed to upper case: STRING TOUPPERCASE EXAMPLE*/

1 comment:

Codecademy Code Foundations

Popular Posts

Categories

Android (23) AngularJS (1) Assembly Language (2) Books (11) C (75) C# (12) C++ (81) Course (3) Data Science (1) Data Strucures (4) Downloads (1) Engineering (13) flutter (1) FPL (17) Hadoop (1) HTML&CSS (40) IS (25) Java (89) Leet Code (4) Pandas (2) PHP (20) Projects (19) Python (435) R (69) Selenium Webdriver (2) Software (14) SQL (27)