Search My Blog

Saturday, August 17, 2013

static and final fields in an abstract class and an interface

The fields in an interface can be static and final only.
Static because, the interface cannot be instantiated, hence no point having non static fields.
Final because, the interface logic should be non mutable.

However, fields in an abstract class can be non static and non final.
Why?
Abstract class cannot be instantiated, so why we need non static fields?
Final?

No comments:

Post a Comment