How to convert a String to Upper case

Following example shows how to convert a string to upper case in Java.

StringToUpperCase.java

package com.ehowtonow.javastring;

public class StringToUpperCase {

    public static void main(String[] args) {
        String input = "eHowToNow Java tutorials contains tutorials for Java programers day to day needs tutorials like Java, Spring, Hibernate, String, JSON, Jackson, GSON, XML parsing, Web Service, SOAP Web Service, RESTful Web Service";
        String upperCase = input.toUpperCase();

        System.out.println("Input String : " + input);
        System.out.println("Upper case String : " + upperCase);

    }

}

Result

Input String : “eHowToNow Java tutorials contains tutorials for Java programers day to day needs tutorials like Java, Spring, Hibernate, String, JSON, Jackson, GSON, XML parsing, Web Service, SOAP Web Service, RESTful Web Service
Upper case String : EHOWTONOW TUTORIALS CONTAINS TUTORIALS FOR JAVA PROGRAMERS DAY TO DAY NEEDS TUTORIALS LIKE JAVA, SPRING, HIBERNATE, STRING, JSON, JACKSON, GSON, XML PARSING, WEB SERVICE, SOAP WEB SERVICE, RESTFUL WEB SERVICE


Ask your questions in eHowToNow Forum

Post your technical, non-technical doubts, questions in our site. Get answer as soon as possible, meanwhile you can help others by answering, unanswered questions.
To Ask new Question : Ask Question
Check our existing discussions : Questions & Answers

  1. Java String codePointCount() method with example
  2. Java String concat() method with example
  3. Java String compareTo() method with example
  4. Java String copyValueOf(char data[]) method with example
  5. Java String Compare
  6. Java String format() method with example
  7. Java String copyValueOf() method with example
  8. Java String compareToIgnoreCase() method with example
  9. String Concatenation in Java
  10. How to get Character unicode point in a String
  11. Java String equalsIgnoreCase() method with example
  12. Remove the particular character from string
  13. How to Split the String in Java
  14. Java String equals() method with example
  15. Java String indexOf(String str, int fromIndex) method with example

Be the first to comment

Leave a Reply