Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • DSA Tutorial
  • Data Structures
  • Algorithms
  • Array
  • Strings
  • Linked List
  • Stack
  • Queue
  • Tree
  • Graph
  • Searching
  • Sorting
  • Recursion
  • Dynamic Programming
  • Binary Tree
  • Binary Search Tree
  • Heap
  • Hashing
  • Divide & Conquer
  • Mathematical
  • Geometric
  • Bitwise
  • Greedy
  • Backtracking
  • Branch and Bound
  • Matrix
  • Pattern Searching
  • Randomized
Open In App
Next Article:
Java String substring() Method
Next article icon

Java String toUpperCase() Method

Last Updated : 23 Dec, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

Java String toUpperCase() method of String class is used to convert all characters of the string into an uppercase letter.

Example:

Java
class Geeks  {     public static void main(String args[])      {           	// Custom input string         String str = "Geeksforgeeks";          // Converting above input string to         // uppercase letters using UpperCase() method         String res = str.toUpperCase();          // Print the uppercased string         System.out.println(res);     } } 

Output
GEEKSFORGEEKS 

Note: Lowercase is done using the rules of the given Locale.

There is 2 variant of toUpperCase() method. The key thing that is to be taken into consideration is toUpperCase() method worked the same as to UpperCase(Locale.getDefault()) method as internally default locale is used. 

Java String toUpperCase(Locale locale)

The toUpperCase(Locale locale) method returns a new String object which is the original string in upper case with respect to the Locale method parameter. 

Syntax String toUpperCase() Method in Java

public String toUpperCase(Locale loc)

Parameters:

  • Type 1 : Locale value to be applied as it converts all the characters into
  • Type 2 : NA

Example:

Java
import java.util.Locale;  class Geeks  {     public static void main(String args[])      {         // Custom input string         String str = "Geeks for Geeks";          // Locales with the language "tr" for TURKISH         //"en" for ENGLISH is created         Locale TURKISH = Locale.forLanguageTag("tr");         Locale ENGLISH = Locale.forLanguageTag("en");          // Converting string str to uppercase letter         // using TURKISH and ENGLISH language         String strup1 = str.toUpperCase(TURKISH);         String strup2 = str.toUpperCase(ENGLISH);                System.out.println(strup1);         System.out.println(strup2);     } } 

Output
GEEKS FOR GEEKS GEEKS FOR GEEKS


Next Article
Java String substring() Method

N

Niraj_Pandey
Improve
Article Tags :
  • DSA
  • Java
  • Java-Functions
  • Java-Strings
Practice Tags :
  • Java
  • Java-Strings

Similar Reads

  • Java String toLowerCase() Method
    Java String toLowerCase() method is used to convert all letters to lowercase in a given string. Example:[GFGTABS] Java import java.util.*; class Geeks { public static void main(String args[]) { // Custom input string String s = "Geeks for Geeks"; // Converting string s to lowercase letter
    2 min read
  • Java String substring() Method
    In Java, the substring() method of the String class returns a substring from the given string. This method is most useful when you deal with text manipulation, parsing, or data extraction. This method either takes 1 parameter or 2 parameters, i.e., start and end value as arguments.In case the end pa
    3 min read
  • StringJoiner toString() method in Java
    The toString() of StringJoiner is used to convert StringJoiner to String. It returns the current value, consisting of the prefix, the values added so far separated by the delimiter, and the suffix, unless no elements have been added in which case, the prefix + suffix or the emptyValue characters are
    2 min read
  • Java String charAt() Method
    String charAt() method in Java returns the character at the specified index in a string. The Index of the first character in a string is 0, the second character is 1, and so on. The index value should lie between 0 and length() - 1. If the index value is greater than or equal to the string length or
    3 min read
  • JavaTuples toString() method
    The toString() method in org.javatuples is used to convert the values in TupleClass into a String. This method is inherited from the JavaTuple class. This method can be used to any tuple class object of javatuples library. It returns a String value formed with the values in the TupleClassObject. Met
    2 min read
  • Java String indexOf() Method
    In Java, the String indexOf() method returns the position of the first occurrence of the specified character or string in a specified string. In this article, we will learn various ways to use indexOf() in Java. Example: Below is the simplest way that returns the index of the first occurrence of a s
    3 min read
  • Java String toCharArray() Method With Example
    In Java, the toCharArray() method of the String class converts the given string into a character array. The returned array length is equal to the length of the string. This is helpful when we need to work with individual characters of a string for tasks like iteration or modification. Example: Below
    2 min read
  • JSTL fn:toUpperCase() Function
    In JSTL, the fn:toUpperCase() function is used to transform all the characters in a specified string to uppercase. If the input string is in lowercase, then this function can convert all the characters into uppercase. In this article, we will see the Syntax along with Parameters and detailed impleme
    1 min read
  • Java String.copyValueOf() Method
    The copyValueOf() method in Java is used to create a new String by copying characters from a character array. It is a static method of the String class. Variants: There are two variants of this method. Copy Entire Character ArrayCopy Subarray1. Copy Entire Character ArrayThis method copies the entir
    3 min read
  • Java String codePointAt() Method
    The codePointAt() method in Java is part of the String class. It is used to return the Unicode value of the character at the specified index in the string. This method is very useful when working with characters beyond the Basic Multilingual Plane (BMP), such as emojis or special symbols. Example 1:
    3 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences