grzz
- 1,030
- 26
- TL;DR
- I cannot see why there are errors displayed in lines 22 and 23.
Java:
//program showing an advantage of using arrays
public class Arr3
{
public static void main(String []args)
{
System.out.println("There are 31 days in the month of Jan");
System.out.println("There are 27 days in the month of Feb");
System.out.println("There are 31 days in the month of Mar");
System.out.println("There are 30 days in the month of Apr");
System.out.println("There are 31 days in the month of May");
/*We can make use of an array with the number of days in the month
* and another array with the names of the months and use these two
* loops to go through these numbers of days and these names of
months*/
int mdays []={31, 37, 31,30, 31};
String months []={Jan, Feb, Mar, Apr, May};
for(i = 0; i < mdays.length; i++)
{
System.out.println("There are " + mdays[i] + " days in the month
of " + months[i]);
}
}
}
Please help me.
Thanks.
Last edited:
. You can try NetBeans or IntelliJ IDEA. A better IDE will help you code better by pointing out your errors even before you compile the code, suggest improvements to the code, and help you view documentation with ease (which is very much necessary and not taught in most schools/courses).