Example For toString() method of character class.

Example For toString() method of character class.


Posted in : Core Java Posted on : October 1, 2010 at 3:37 PM Comments : [ 0 ]

In this example, We will discuss about toString() method of character class.

Example For toString() method of character class

In this example, We will discuss about toString() method of character class. This method returns a string object that represents the specified character. As a result we get a string of single character. The character is passed as a parameter to the method.

Example: CharacterToString.java

package com.devmanuals;

public class CharacterToString {

	public static void main(String[] args) {
		System.out.print("The one character string is= ");
		System.out.println(Character.toString('R'));
		System.out.print("The one character string is= ");
		System.out.println(Character.toString('K'));
		System.out.print("The one character string is= ");
		System.out.println(Character.toString('m'));

	}

}

Output:

 The one character string is= R

The one character string is= Khe one chracter string is= m

Download This Example.

Go to Topic «PreviousHomeNext»

Your Comment:


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

 
Tutorial Topics