Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8731655
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:17:16+00:00 2026-06-13T09:17:16+00:00

While we all understand that to declare constants (for brevity reasons) in an interface

  • 0

While we all understand that to declare constants (for brevity reasons) in an interface as opposed to a class is evil because it pollutes namespace for and post Java 5 you can use static imports to reduce verbosity (Effective Java Item 17). However, a colleague of mine pointed out that a developer can miss out declaring the variable as final (public and static can be discounted as absence of it would be a compilation error) when defining it in a class whereas they come implicitly for interfaces. Any arguments for/against it? I guess this might have been discussed at length before as it seems pretty rudimentary, but my google-fu is not helping me today :). Would appreciate if someone can opine here or point me to a place where this may have already been discussed.

Thanks in advance!

EDIT:
The interface file thus defined will not be used in the class hierarchy of its clients but will purely serve to house constants.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T09:17:17+00:00Added an answer on June 13, 2026 at 9:17 am

    If using a post Java 5 SDK, then why not evaluate Enums instead of using interfaces to define, public static constants. Nevertheless, nothing wrong in the approach though.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While reading this class BitmapFactory I noticed that almost all methods inside are static.
hi all i want to know that while specifying url in my iphone native
I understand that you can make range queries on column names. Example: Get all
I have a very peculiar problem. I understand that while in the foreground the
I am having a strange problem while making app requests. I understand that when
while all tests complete without errors and fixtures are actually loaded. Is it Django
My idea was to copy a dictionary while resetting all the values of the
The ? wildcard represents unauthenticated users while * represents all users, authenticated and unauthenticated.
I would like to reuse certain packages installed systemwide, while ignoring all others. I
I have been using CodeIgniter all these while, and have solid foundation in OOP

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.