News:

GinGly.com - Used by 85,000 Members - SMS Backed up 7,35,000 - Contacts Stored  28,850 !!

Main Menu

Java String toCharArray Example

Started by VelMurugan, Nov 28, 2008, 11:46 PM

Previous topic - Next topic

VelMurugan

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]);
  }
}

Source : CodeDiary