Java toUpperCase - yuriyni.com

Java toUpperCase. Tutorial and Examples

What is a toUpperCase?

The java toUpperCase() method of String class is used for getting a substring from the string.

public final class String extends Object implements Serializable, Comparable<String>, CharSequence, Constable, ConstantDesc

...

The String class represents character strings. All string literals in Java programs, such as "abc", are implemented as instances of this class.

Beginning with JDK 9, all of java.lang is part of the java.base module. The String class represents character strings. All string literals in Java programs, such as "abc", are implemented as instances of this class.

Java Platform, Standard Edition & Java Development Kit Version 16 API Specification
Module java.base
Package java.lang
Class String

Because String objects are immutable, whenever you want to modify a String, you must either copy it into a StringBuffer or StringBuilder, or use a String method that constructs a new copy of the string with your modifications complete.

Syntax #1 of String toUpperCase() method

public String toUpperCase()

The Java String toUpperCase() method converts a string to UPPER case letters using the rules of the default locale. .

String toUpperCase Example #1

package com.yuriyni.java.base.java.lang;

public class ToUpperCaseDemo {
    public static void main(String[] args) {

        String myStr = "hello world | YuriyNi.com";
        System.out.print(myStr.toUpperCase());
    }
}

Output

HELLO WORLD | YURIYNI.COM

Download source code

https://github.com/yuriynee/learning-java-with-yuriy-ni