- 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]); } } }*/

8th Jun 2021, 7:50 AM
Somvardhan Shiva
Somvardhan Shiva - avatar
3 Respostas
+ 2
Somvardhan Shiva Syntax for declaring array: String[] arr = { }; See the solution here with proper explanation https://www.sololearn.com/Discuss/2806276/?ref=app
8th Jun 2021, 8:10 AM
A͢J
A͢J - avatar
+ 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]); } } }
8th Jun 2021, 8:11 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
0
Thanks
8th Jun 2021, 8:33 AM
Somvardhan Shiva
Somvardhan Shiva - avatar