I didn’t get out put in -- char[ ] country=(' America','Bangladesh ') for( char t: country) system.out.println(t) in java array | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I didn’t get out put in -- char[ ] country=(' America','Bangladesh ') for( char t: country) system.out.println(t) in java array

I used first bracket here because there is no option of curly brac in my phone

30th May 2020, 9:28 PM
The Black Hat 🇨🇦🇧🇩
The Black Hat  🇨🇦🇧🇩 - avatar
1 Answer
+ 2
"America" and "Bangladesh" are strings. String is a built-in data-type in Java. Use and array of strings: String[] country = {"America","Bangladesh"}; for(String t: country) System.out.println(t); That should work. If you need to convert your Strings to char arrays then use the toCharArray method. char[] cArr = "America".toCharArray(); for(char c: cArr){ //do something } Download a keyboard: https://www.sololearn.com/discuss/739119/?ref=app https://www.sololearn.com/discuss/180235/?ref=app https://www.sololearn.com/discuss/79167/?ref=app
30th May 2020, 9:43 PM
Kevin ★