space seperator in string in java
String[] splitted = "peter,james,thomas".split(",");
space seperator in string in java
String[] splitted = "peter,james,thomas".split(",");
how to read space separated characters in java
# Let input sequence is like ' A B C D E F ( 9 5 a b z '
while(Scanner.hasNextLine()){
String[] c = fileReader.nextLine().split(" ");
for(int i=0;i<c.length;i++){
System.out.print("My character is " + c[i] + " ");
// this is enough for the input sequence
// but if you want a safe approach then use it
for(int j=0;j<c[i].length;j++){
System.out.print("My character is " + c[j].charAt(j) + " ");
}
}
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