Home Java Beginners Java toUpperCase() Method
Questions:Ask|Latest


 
 

Share on Google+Share on Google+

Java toUpperCase() Method

Advertisement
In this section, you will learn how to use toUpperCase() method of the String class.

Java toUpperCase() Method In Java

In this section you will learn about how to use toUpperCase() in Java. From the name of the method you can also know what this function does?, this function is of String class convert the string into upper case

Syntax :

public String toUpperCase()

Return Value :

It return the string in upper case.

Here str is String object, which contain the string to convert in uppercase. toUpperCase() method is of string class.

Description of code : Here is the example using toUpperCase() method  to convert to upper case in java. First we declare a class named "Touppercase.java". In that class we have declared one String object and initialize it with the string "rose india" and passing that string to println() method. Then uppercase() method will return the string in Upper case as "ROSE INDIA".

public class Touppercase {
	public static void main(String args[])
   {
		String str="rose india";
		System.out.println(str.toUpperCase());
	}
}

Output from the program

Download Source Code

Advertisement

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: July 5, 2013

Ask Questions?    Discuss: Java toUpperCase() Method In Java  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments
DMCA.com