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

  • Home
  • SEARCH
  • 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 8321359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T22:59:20+00:00 2026-06-08T22:59:20+00:00

This is from Effective Java Programs that use the int enum pattern are brittle.

  • 0

This is from Effective Java

Programs that use the int enum pattern are brittle. Because int enums are
compile-time constants, they are compiled into the clients that use them.

Can some one explain why the int enum pattern is called compiled type constant and what is meant by compiled into the clients?

Here s’ an example of such a constant :

public static final int APPLE_FUJI = 0;
  • 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-08T22:59:22+00:00Added an answer on June 8, 2026 at 10:59 pm

    Suppose you have two files:

    Foo.java:
    public class Foo
    {
        public static final int SOMETHING = 1;
    }
    
    Bar.java:
    public class Bar
    {
        public static void main(String[] args)
        {
            System.out.println(Foo.SOMETHING);
        }
    }
    

    Compile them both, run java Bar and it will print out 1.

    Now change Foo.java so that SOMETHING is 2, and recompile just Foo.java. Rerun java Bar and it will still print 1. The constant value will be copied to every piece of code that uses it, rather than asking for the value from Foo at execution time.

    In practice, if you recompile everything any time anything changes, this isn’t a problem.

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

Sidebar

Related Questions

A quote from Effective Java states that: A second legitimate use of finalizers concerns
This is from Effective Java : // Implementing a fromString method on an enum
I read Effective Java by Joshua Bloch and removed the 'Constant Interface anti-pattern' from
I am reading about clone from Effective Java It says that in clone the
This program is from effective java 2nd edition book, I couldn't understand how the
This is a follow-up from this question : Effective Java 2nd Edition, Item 17:
I am trying to fathom the following lines from Effective Java One thing that
This code snippet for the interface SetObserver is taken from Effective Java (Avoid Excessive
I read from Effective Java that In the absence of synchronization the following sequence
From Effective Java 2ed Item 2: telescoping constructor pattern, in which you provide a

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.