I was looking at this example and was wondering what the first line does:
private SiteStreamsListener listener = new SiteStreamsListener() {
<
ArrayList myList = new ArrayList() {
@Override
String toString()
{
//
}
//
}
Yes you could do that. You can defiantly override public,protected methods. Although you can add new methods but those will not be accessiable through myList instance of ArrayList class.
Please refer to the java documentation for more details.
https://docs.oracle.com/javase/tutorial/java/javaOO/anonymousclasses.html#declaring-anonymous-classes