I have two classes under the same package.
Class A has a private hashmap _books = new ConcurrentHashMap<String,Book>();
String title is the key.
In class B, I would like to retrieve a certain Book
object by its title from the private map in class A.
I tried to add a public method in class A
public Book getBookFromMap(String title ){
return _books.get(title);
}
And in class B I tried to call the method, but that didn't work. Eclipse says "the method getBookFromMap is undefined". In class I tried to do this:
Book bookFromMap= getBookFromMap(booktitle);
That's when the red line appeared under the getBookFromMap in class B. I reckon that maybe I'm not calling it correctly? How can I solve the problem? Many thanks in advance!