java tutorial - Java Strings toUpperCase() method - java programming - learn java - java basics - java for beginners



Java strings to uppercase

Learn Java - Java tutorial - Java strings to uppercase - Java examples - Java programs

Description

The toUpperCase () method has two options. The first option converts all the characters in a given string to uppercase, using the rules of this locale.

  • The second option takes the locale as an argument for use during the conversion to uppercase.

Syntax

Syntax of this method:

public String toUpperCase()

or

public String toUpperCase(Locale locale)
click below button to copy the code. By - java tutorial - team

Options

Detailed information about the parameters:

  • No.

Return value

  • In Java, toUpperCase () returns a string that is converted to uppercase.

Sample Code

import java.io.*;
public class Test {

public static void main(String args []) {
String Str = new String("Welcome to wikitechy.com");

System.out.print("Return value:" );
System.out.println (Str.toUpperCase ());

System.out.print("Return Value :" );
      System.out.println(Str.toUpperCase() );
   }
}}
click below button to copy the code. By - java tutorial - team

Output

Return value:WELCOME TO WIKITECHY.COM
Return Value :WELCOME TO WIKITECHY.COM

Related Searches to Java Strings toUpperCase() method