java - Strange issue with an array -
so i'm in middle of working on class called planner [no main in it's separate class], i'm having issue declaring array eclipse. need enter in eclipse see because have no idea means 'syntax error on token ";", , expected'.
here code:
import java.util.scanner; public class planner { private int maxevents = 1000; private int numevents = 0; private int choice; int[] anarray; anarray = new int [1000]; public void planner() { scanner scan = new scanner (system.in); system.out.print("press 1 add event. 2 display events day. 3 display events week. 4 quit: "); choice = scan.nextint(); if (choice == 1){addevent();} if (choice == 2){displayonedate();} if (choice == 3){displayoneweek();} if (choice == 4){system.out.println("have day.");} else {planner();} } public void addevent() { event newevent = new event(); if (numevents == maxevents){system.out.println("error: no more room.");} else { (int i=0; anarray.length > i; i++) { numevents++; newevent.geteventfromuser(); } } } public void displayonedate() { system.out.println("event one: " + anarray[0]); } public void displayoneweek() { } }
when declare
int[] anarray; anarray = new int [1000];
it should be
int[] anarray = new int [1000];
Comments
Post a Comment