Why can not define private and protected modifiers for variables in interface?

1 answer

Answer

1112979

2026-04-14 03:41

+ Follow

No. Interface variables are supposed to be public static final. Interfaces, like abstract classes, cannot be instantiated, so all variables in an interface must be static final ones. They are public because usually interfaces are used throughout an application, and this will ensure versatility.

ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.