- I defined "class Product" with fields "price" and "sales".
- Then, I created an array of type "Product": Product productArray[] = new Product[100]
- Then I filled this array with data from an excel table containing 100 rows and 2 columns (column A: "price" , column B: "sales")
I want to directly access the price of different products, say the price of the product in row 97. That is, I would like to do something like Double variable = productArray[97].price
Is there a way of doing this in java ?
Help would be very much appreciated ! Thank you in advance.
Double variable = productArray[97].price? Sounds like it should work. MaybeproductArray[97].getPrice()? Also, beware that array are 0 indexed: row 1 isproductArray[0].