/end class link in addition to the datathere' constructor and methoddisplaylink()that displays the link' data in the format { object purists would probably object to naming this method displaylink()arguing that it should be simply display(this would be in the spirit of polymorphismbut it makes the listing somewhat harder to understand when you see statement like current display()and you've forgotten whether current is link objecta linklist objector something else the constructor initializes the data there' no need to initialize the next fieldbecause it' automatically set to null when it' created (although it could be set to null explicitlyfor clarity the null value means it doesn' refer to anythingwhich is the situation until the link is connected to other links we've made the storage type of the link fields (idata and so onpublic if they were private we would need to provide public methods to access themwhich would require extra codethus making the listing longer and harder to read ideallyfor security we would probably want to restrict link-object access to methods of the linklist class howeverwithout an inheritance relationship between these classesthat' not very convenient we could use the default access specifier (no keywordto give the data package access (access restricted to classes in the same directorybut that has no effect in these demo programswhich only occupy one directory anyway the public specifier at least makes it clear that this data isn' private the linklist class the linklist class contains only one data itema reference to the first link on the list this reference is called first it' the only permanent information the list maintains about the location of any of the links it finds the other links by following the chain of references from firstusing each link' next field class linklist private link first/ref to first link on list /public void linklist(/constructor first null/no items on list yet /public boolean isempty(/true if list is empty return (first==null)