I am completing an assignment and I was provided an interface called Place. It has several defined methods and no variables. I created a class that implements Place and this contains a string variable name and all the methods from the Place interface.
public class PlaceImpl implements Place
{
public String name;
...
}
I then create an object
Place p = new PlaceImpl(placeName);
However, when I try to access p.name I get the error "cannot find symbol". Can I access instance variables in this way or do I just need to find somewhere else to store my variables? Thanks
Update: I cannot change the Place interface and I have to use a variable of type Place to integrate with the rest of the code I was provided.