Array confusion

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • scatpat
    New Member
    • Sep 2007
    • 1

    #1

    Array confusion

    I am having some challenges with declaring an array class. I know I am doing something wrong with one line of code. That line of code is

    int arraySize = 100;
    ProductInfo myProduct[] = new array(arraySize );

    I am getting an error message "array can not be resolved to a type". Can someone explain what this error means and how I can fix it?
  • Ganon11
    Recognized Expert Specialist
    • Oct 2006
    • 3651

    #2
    You have your syntax wrong. What you want is:

    [CODE=java]ProductInfo myProduct = new ProductInfo[arraySize];[/CODE]

    Comment

    • JosAH
      Recognized Expert MVP
      • Mar 2007
      • 11453

      #3
      Originally posted by Ganon11
      You have your syntax wrong. What you want is:

      [CODE=java]ProductInfo myProduct = new ProductInfo[arraySize];[/CODE]
      Or more likely this:

      [CODE=java]ProductInfo[] myProduct = new ProductInfo[arraySize];[/CODE]

      kind regards,

      Jos

      Comment

      Working...