100.0k views
4 votes
List and explain the error in the code

public class Weekdays {

public static void main(String[] args) {

final String[] WEEKDAYS = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"}

System.out.println("List of weekdays:");

for (int i = 1; i
System.out.println(WEEKDAYS[i]);

}

User Broseph
by
7.1k points

1 Answer

4 votes

Answer:

Errors:

1. semicolon is missing in the declaration of string.

2. for loop is not complete.

3. one curly braces is missing for closing class.

Step-by-step explanation:

In the programming, semicolon is used at the end of the statement as a terminator.

in the declaration of string array semicolon is missing.

for loop is incomplete.

syntax of for loop;

for(initialization;condition;increment/decrement)

{

statement;

}

and finally curly braces in the programming braces must be enclose.

here, the braces of the class is missing.

User Orbnexus
by
6.3k points