convert string to char array in java
String str = "example";
char[] ch = str.toCharArray();
convert string to char array in java
String str = "example";
char[] ch = str.toCharArray();
char array in java
char[] JavaCharArray = new char[5];
JavaCharArray[0] = 'r';
JavaCharArray[1] = 's';
JavaCharArray[2] = 't';
JavaCharArray[3] = 'u';
inputting an array of characters
import java.util.Scanner;
public class Demo {
public static void main(String args[]) {
Scanner s = new Scanner(System.in);
System.out.println("First add some characters...");
char[] a = s.next().toCharArray();
System.out.println("Elements = ");
for (int i = 0; i < a.length; i++)
System.out.println(a[i]);
}
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us