User Tools

Site Tools


Sidebar

Programming Reference/Librarys

Question & Answer

Q&A is closed







java:lang:string:toarray

This is an old revision of the document!


toCharArray

public char[] toCharArray()

description of toCharArray()

converts a string to a new character array

example of toCharArray in java

package codereferececomjava;
 
public class CodeRefereceComJava {
 
 
    public static void main(String[] args) {
        String str = "some Text";
        char[] text;
 
 
        System.out.println(str);
 
        text = str.toCharArray();
        for (int i = 0; i <= text.length - 1; i++) {
 
        System.out.println(text[i]);
 
        }
    }
}

output of toCharArray in java

  some Text
  s
  o
  m
  e
   
  T
  e
  x
  t
 

on the occasion of the current invasion of Russia in Ukraine

Russian Stop this War
java/lang/string/toarray.1366267512.txt · Last modified: 2024/02/16 01:11 (external edit)

Impressum Datenschutz