Hi. If given an arraylist in an interface like this:

interface Dictionary {
	public boolean hasWord(String word);
	public ArrayList<String> suggestions( String word );
	public void addWord( String word );
	
}

How do I use it?
If I try to use it as a normal arraylist, I get the error that the class implementing the interface is "not abstract and does not override abstract method suggestions(java.lang.String) in Dictionary"
How do I use it?

The error has nothing to do with the ArrayList. You forgot to implement the method: suggestions(String)

So I need to do both this:

ArrayList suggestions = new ArrayList();

and this:

public ArrayList<String> suggestions( String word )
	{
		
		return suggestions;
	}

?

So I need to do both this:

ArrayList suggestions = new ArrayList();

and this:

public ArrayList<String> suggestions( String word )
	{
		
		return suggestions;
	}

?

when implementing an interface, you need to implement all of it's methods.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.