I am new to Java (or for simplicity sake for any programming language) and this is what I wrote;
3 public class Sample {
4 public static void main(String args[]){
5 int month = Integer.parseInt(args[0]);
6 if (month == 12 || month == 1 || month==2){
7 System.out.println("The season is Winter");
8 }
9 elseif (month==3||month==4||month==5);
10 {
11 System.out.println("The season is Spring");
12 }
13 elseif (month==6||month==7||month==8);
14 {
15 System.out.println("The season is Summer");
16 }
17 elseif (month==9||month==10||month==11);
18 {
19 System.out.println("The season is Autmn");
20 }
21 else{
22 System.out.println("Wrong input entered");
23 }
24
25 }
26 }
This code results in following error; Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 at Sample.main(Sample.java:5)
can someone help what error i am making here causing it to throw the error?