as far as I’ve researched around, a static class in Java only makes sense if it’s an inner class.
But I just came across this example and I want to understand what the author meant, what it does, and how it works:
from: http://developer.android.com/guide/topics/ui/actionbar.html
public static class TabListener<T extends Fragment> implements ActionBar.TabListener {
// a normal class with public constructor and TabListener methods
...
}
what static means here and why should it work?
and why is him extending Fragment with <T > ? instead of the normal way.
thanks!
edit:
wow, that was a lot of answers very quickly.
thanks all who shared their knowledge here.
I’ll mark @npe answer as the correct one as he correctly pointed out that the text around the example indicates that this class is a member.
also there’s some weird formatting on stack overflow that I just fixed on my original question and repeat here:
and why is him extending Fragment with <T > ?
and @Ahmad answered that one, but I can’t mark two correct answers.
There is no way to declare member class as
static– it will issue a compiler error.And your example is about an member class – quoting the page you linked to:
So the page states, that the
TabListeneris a member class.