- 1
Wanna output all days of week.please help where am I wrong?
/* public class Main { public static void main(String[] args) { String [] days = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]; for (String i = 0; i <= 7; i++) { System.out.println(days[i]); } } }*/
3 Antworten
+ 2
Somvardhan Shiva
Syntax for declaring array:
String[] arr = { };
See the solution here with proper explanation
https://www.sololearn.com/Discuss/2806276/?ref=app
+ 2
public class Program {
public static void main(String[] args) {
String [] days = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"};
for (int i = 0; i < 7; i++) {
System.out.println(days[i]);
}
}
}
0
Thanks