Answers for "string.tochararray java"

2

Java String toCharArray() method

// String toCharArray() method example or string to char array java
public class StringToCharArrayDemo
{
   public static void main(String[] args)
   {
      String strInput = new String("Flower Brackets");
      // using toCharArray() method java
      char[] chArray = strInput.toCharArray();
      System.out.println("Character array: ");
      for(char ch : chArray)
      {
         System.out.println(ch);
      }
   }
}
Posted by: Guest on December-05-2020
8

string to char in java

// getting single character from string..
String str="abcd";

char c=str.toChar(0); 

System.out.println("output is "+c); // output is a
Posted by: Guest on May-11-2020
0

toCharArray() method java

public class CharArrayExample{
   public static void main(String args[]){
       String str = new String("Welcome to BeginnersBook.com");
       char[] array= str.toCharArray();
       System.out.print("Content of Array:");
       for(char c: array){
           System.out.print(c);
       }
   }
}
Posted by: Guest on July-22-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language