In a performance critical application which strategy is better?
Having a single big constants (.java) file (public static final variables)
or multiple files with lesser number of variables.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
Makes no difference once it is compiled.
If those constants are primitives, they are inlined at compile time. The class that defined them is not even needed at runtime.
If they are objects, they are loaded once the class file that defines gets accessed the first time. That will only happen once during the life of your JVM.