I have declared an ArrayList to store my objects of the class Books.
static ArrayList<Books> bookData = new ArrayList<Books>();
So I have multiple methods inside class Books. Let's say I have a method named... getName(), Let's assume I have objects stored inside ArrayList and I want to call the method for the object stored in the array list.
So Is this correct:
bookData[1].getName();
or
Is this correct:
bookData.get(1).getName();
If the first is wrong, then why? Is there a method to call the object stored inside ArrayList?
[index]