In this section, you will learn how to convert a char into a string type data. The java.lang package provides the functionality to convert a character into a string.
This program takes a character at the console and converts it into a string format using by the toString() method. This method converts the character into an integer type data. The character class wraps a value of the primitive type char in an object. The toString method returns a string object representing this character's values.
Here is the code of this program:
Output of this program.
Enter a Character:
Character value is R
String value is R
Rs. 20,000 US$ 300
Today: Rs. 10,000 US$150
Course Duration: 30 hrs
Posted on: June 15, 2007 If you enjoyed this post then why not add us on Google+? Add us to your Circles