Home » Online Computer Education » Learn Fundamentals of Java Programming “String Manipulation in Java Programming ” Lesson 25

Learn Fundamentals of Java Programming “String Manipulation in Java Programming ” Lesson 25

String Manipulation

In the previous section, we learned to manipulate arrays using Java prebuilt classes. In this section we learn to manipulate Strings using the String class present in the java.lang package. The first method we will use from the String class is the toUpperCase() method. This method converts a string to all uppercase letters.

String myString = “Hello World”;
System.out.println(“UpperCase: ” + myString.toUpperCase());
The output of the code given above will be:

HELLO WORLD

The following table shows the commonly used String class methods and the result of applying them on the string “Hello World”.

Java fundamentals  array  17

Figures 1.9g and 1.9h show the String Demo program and its output respectively.

Java fundamentals  array  18

About

The main objective of this website is to provide quality study material to all students (from 1st to 12th class of any board) irrespective of their background as our motto is “Education for Everyone”. It is also a very good platform for teachers who want to share their valuable knowledge.

Leave a Reply

Your email address will not be published. Required fields are marked *