So i'm trying to access an attribute of a class object within an array.
document doc1 = new document(1,"Introduction to Java", "Ahmed Raya", "Summary of doc1","History of Java.docx");
document doc2 = new document(2,"Object Oriented Programming", "Ahmed Raya", "Summary of doc2","Document2.pdf");
Object[] docary = {doc1, doc2};
I have an open(directory) function that takes the directory of an object (for example doc1's directory is "History of Java.docx". What i'm trying to do is access the directory attribute of an object within the docary array.
This is basically what i want to do: open(docary[k].directory);where k is an integer variable inputted by the user. How can i do this?
Thanks