Home » Java programming language

Java String toUpperCase() Method with Example

Java String toUpperCase() Method: Here, we are going to learn about the toUpperCase() method with example in Java.
Submitted by IncludeHelp, on February 08, 2019

String toUpperCase() Method

toUpperCase() method is a String class method, it is used to convert given string into the uppercase.

Syntax:

    String String_object.toUpperCase();

Here, String_object is a String object which we have to convert into uppercase. The method does not change the string; it returns the uppercase converted string.

Example:

    Input:
    str = "Welcome at IncludeHelp!"
    Function call:
    ans = str.toUpperCase()

    Output:
    ans = "WELCOME AT INCLUDEHELP!"

Code:

public class Main
{
    public static void main(String[] args) {
		String str = "Welcome at IncludeHelp!";
		String ans = str.toUpperCase();
		System.out.println("str = " + str);
		System.out.println("ans = " + ans);		
    }
}

Output

str = Welcome at IncludeHelp!
ans = WELCOME AT INCLUDEHELP!





Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.
Learn PCB Designing: PCB DESIGNING TUTORIAL







Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing » Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.