String methods – toString,toUppercase,toLowercase,toChararray

In this post, we will discuss about the string methods toString,toUppercase,toLowercase,toChararray.

Let’s see them one by one with examples.

String toString():

This method returns itself i.e. a same string.

Output: testingpool.com

String toUpperCase():

This methods converts all characters of a string into uppercase and returns a string.

Output:TESTINGPOOL.COM

String toLowerCase():

It converts all characters of a string into lowercase and returns string.

Output: testingpool.com

char[] toCharArray():

This method converts a string into  a new character array.

The length of the array will be same as length of the string.In the below example, it will result in the same string.

Output:TESTINGPOOL.COM
Ask Question
If you have any question, you can go to menu ‘Features -> Q&A forum-> Ask Question’.Select the desired category and post your question.
Print Friendly, PDF & Email
String methods - getBytes() and getChars()
String methods - isEmpty() and lastIndexof
Shekhar Sharma

Shekhar Sharma

Shekhar Sharma is founder of testingpool.com. He is an automation engineer having more than 8 years of experience who loves troubleshooting in automation and finding innovative ways to solve the problems. His other leisurely activities includes playing harmonica, paintings, sketching portrait, watching movies and travelling etc.

You may also like...

1 Response

  1. August 7, 2015

    […] char[] toCharArray() […]