Thread: Array Error

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2013
    Posts
    4
    Rep Power
    0

    Array Error


    I have created this array yet their are red squiggly lines under NameofWorkers[] code lines. The error hint box says " ']' expected." How do I fix this?


    code:

    {
    String[] NameofWorkers2 = new String[4];

    NameofWorkers2[0] = "Joan";
    NameofWorkers2[1] = "Bill";
    NameofWorkers2[2] = "Louis";
    NameofWorkers2[3] = "Chloe";

    System.out.println(NameofWorkers[0]);

    }
  2. #2
  3. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,711
    Rep Power
    347
    Can you use a javac compiler to get a compiler error message and post that?
    The red lines aren't shown in what you posted.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2013
    Posts
    4
    Rep Power
    0
    I figured it out, but thank you.

IMN logo majestic logo threadwatch logo seochat tools logo