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 6664141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:34:39+00:00 2026-05-26T02:34:39+00:00

Is it acceptable to create large static resource files? For example: public class Resources

  • 0

Is it acceptable to create large static resource files? For example:

public class Resources {
    public static String STRING1 = "xxx";
    public static String STRING2 = "xxx";
    ...
    public static String STRINGN = "xxx";
}

I want to have a large file that will have a list of all of the strings that the application will use. Will this cause problems? I’m not entirely sure how static classes are held in memory, so I don’t know if this causes memory issues. Is it too “ugly” or not good form? Is there a better way to do it?

  • 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-05-26T02:34:39+00:00Added an answer on May 26, 2026 at 2:34 am

    I would save language files and such things in the filesystem as plain text (or some special format). Then you can change the text, etc. easily. Then you can write a static class (LanguageFactory) to get your strings.

    Example language file:

    English language file

    !–OutGameMenu Strings–!

    joinGame = Join Game
    createGame = Create Game

    LanguageFactory:

    public class LanguageFactory {
        private static final String PREFIX = "/languages/";
        public static final int ENGLISH = 1;
        public static final int GERMAN = 2;
        public static final int DEFAULT = ENGLISH;
        //List of available InProperties:
    
        public static final String JOIN_GAME = "joinGame";
        public static final String CREATE_GAME = "createGame";
    
        private static Properties language;
    
        public static String getString(String text){
            if(language == null){
                setLanguage(DEFAULT);
            }
            return language.getProperty(text);
        }
    
        public static void setLanguage(int language){
            switch (language) {
            case ENGLISH:
                setLanguage("en.lang");
                break;
            case GERMAN:
                setLanguage("de.lang");
                break;
            }
        }
    
        private static void setLanguage(String path){
            language = new Properties();
            try {
                InputStream fi = LanguageFactory.class.getResourceAsStream((PREFIX+path));
                language.load(fi);
                fi.close();
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it acceptable to make more than 1 facade class (not instance) in a
Is it acceptable to add types to the std namespace. For example, I want
Do you consider it an acceptable or a bad practice to create an abstract
How do you create a regular expression for a certain string? And can you
In XNA, is it acceptable to create a GameService for an object that isn't
Is it possible to create a login process that requires a public/private key through
An example of my scenario is a large setup page for an application, the
I'd like to create a div with a background image css: #mydiv { background-image:url('/public/images/foo.png');
Whats wrong with this picture? Model: validates_acceptance_of :terms_of_service, :on => :create, :accept => true,
Is it acceptable to submit from an http form through https? It seems like

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.