Results 1 to 3 of 3
  1. #1
    lodaSchitt is offline Member
    Join Date
    Apr 2011
    Posts
    7
    Rep Power
    0

    Default Illegal start of expression

    Hi

    When I compile the code below, I get an "illegal start of expression"
    The offending code is in red

    Java Code:
     public ArrayList<Lot>getUnsold()
        {
           [COLOR="Red"] private ArrayList<Lot> us;[/COLOR]
            int j=0;
            us=new ArrayList<Lot>();
            for (int i=0; i<lots.size();i++) {
                Lot sl=getLot(i);
                if (sl.highestBid()==null) {
                    us(j)=sl(i);
                    j++;
                }
            }
            return us;
        }
    Last edited by Fubarable; 04-28-2011 at 10:05 PM. Reason: code tags added

  2. #2
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,565
    Rep Power
    12

    Default

    Looks like you are missing a space in the first line after the return type.

    Also "us(j)=sl(i);" is not how you access lists: use List methods to get and set elements.
    Last edited by pbrockway2; 04-28-2011 at 10:05 PM.

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

Similar Threads

  1. Illegal start of expression
    By Nigel in forum New To Java
    Replies: 5
    Last Post: 03-11-2011, 12:42 PM
  2. Need help with illegal start of expression
    By WhopperMan in forum New To Java
    Replies: 4
    Last Post: 10-10-2010, 02:58 AM
  3. Illegal Start of an Expression
    By ddatta8 in forum New To Java
    Replies: 3
    Last Post: 12-20-2008, 08:40 PM
  4. Illegal Start of Expression
    By vince425 in forum New To Java
    Replies: 3
    Last Post: 10-18-2008, 07:41 AM
  5. illegal start of expression
    By razmyasdfg in forum CLDC and MIDP
    Replies: 2
    Last Post: 07-27-2008, 10:44 PM

Posting Permissions

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