Results 1 to 2 of 2
  1. #1
    minusten is offline Member
    Join Date
    Apr 2011
    Rep Power

    Lightbulb illegal start of expression


    Im using netbeans and i keep getting a illegal start of exspression error alert ive made the line red

    heres surrounding code;

    public class Main {

    public static void main(String[] args) {

    private final static String[] mainMenuOpts = {"Students","Lecturers","Admin","Exit"};
    private final static String[] studentMenuOpts = {"Add Student","List all Students","Find a Student","Return to Main Menu"};
    private Menu mainMenu = new Menu("MAIN MENU",mainMenuOpts);
    private Menu studentMenu = new Menu("STUDENT MENU",studentMenuOpts);
    private DataStore data = new DataStore();
    private out = System.out;
    private ReadKb reader = new ReadKb();
    /** Creates a new instance of Main */
    public Main() {

  2. #2
    goldest's Avatar
    goldest is offline Senior Member
    Join Date
    Oct 2009
    Pune, India
    Rep Power


    Hey Minusten,

    Local variables [i.e. variables declared inside the method] can not have access modifiers. They can ONLY be declared as final.

    Hope that helps,

    Java Is A Funny Language... Really!
    Click on * and add to member reputation, if you find their advices/solutions effective.

Similar Threads

  1. Illegal start of expression
    By lodaSchitt in forum New To Java
    Replies: 2
    Last Post: 04-28-2011, 11:04 PM
  2. Need help with illegal start of expression
    By WhopperMan in forum New To Java
    Replies: 4
    Last Post: 10-10-2010, 03:58 AM
  3. illegal start of expression
    By rajivjoshi in forum New To Java
    Replies: 3
    Last Post: 05-31-2010, 10:12 AM
  4. Illegal Start of an Expression
    By ddatta8 in forum New To Java
    Replies: 3
    Last Post: 12-20-2008, 09:40 PM
  5. Illegal Start of Expression
    By vince425 in forum New To Java
    Replies: 3
    Last Post: 10-18-2008, 08:41 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts