Java String toCharArray Example
String class toCharArray method example
String class toCharArray method example. This example shows you how to use toCharArray method.This method Converts this string to a new character array.
Here is the code:-
/**
* @(#) CharArraystring.java
*Program that Converts the given string to a new character array.
* @Version 01-May-2008
* @author Rose India Team
*/
public class CharArraystring
{
public static void main(String[] args)
{
String str = "RoseIndia is my Team.";
//Converts this string to a new character array.
char[] arr = str.toCharArray();
// Display the contents of the char array at 5 position.
System.out.println(arr[5]);
}
}
|
null
|