Table of Contents
Java String’s toCharArray() method can be used to convert String to char Array in java. It is simplest method to convert String to char Array.
Example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
package org.arpit.java2blog; public class StringToCharArrayMain { /* * @Author: Aprit Mandliya */ public static void main(String[] args) { String str="java2blog"; char[] charArr=str.toCharArray(); for (int i = 0; i < charArr.length; i++) { System.out.println(charArr[i]); } } } |
1 2 3 4 5 6 7 8 9 10 11 |
j a v a 2 b l o g |
Other String Programs are :
String :
- How to reverse String in java
- How to check if two Strings are angrams
- Find length of String without using java inbuilt length method
- Find all substrings of String in java
- Find First non repeated character in a String
- Java Program to check Palindrome String
- Why String is immutable in java
- Find duplicate characters in String
Was this post helpful?
Let us know if this post was helpful. Feedbacks are monitored on daily basis. Please do provide feedback as that\'s the only way to improve.