how to do this? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

how to do this?

String word = "apple"; how can i take apart the chars from the String 'word', mix them up and display them like that: p , a , l , p , e ?

25th Jun 2020, 12:30 PM
Yahel
Yahel - avatar
4 Answers
+ 1
yahel String word = "apple"; char[] w = word.toCharArray(); for(char c : w) System.out.print(c + ",");
25th Jun 2020, 12:59 PM
A͢J
A͢J - avatar
25th Jun 2020, 3:02 PM
Kaustubh Vats
Kaustubh Vats - avatar
0
AJ Anant , this is only displaying the chars as they are... i need them to be mixed up. not like: a , p , p , l , e , i need it like that (for example): l , p , a , p , e
25th Jun 2020, 1:07 PM
Yahel
Yahel - avatar
0
Kaustubh Vats thank you!
25th Jun 2020, 4:12 PM
Yahel
Yahel - avatar