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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:33:06+00:00 2026-05-23T02:33:06+00:00

I am developing a dynamic web project using Tomcat. It is useful to have

  • 0

I am developing a dynamic web project using Tomcat. It is useful to have a global flag that is the only thing I have to change between my development and deployment servers. The biggest use of the flag is with print statements.

public class Debug {
    public final static boolean DEVEL = true;        
    public static void print(String message){
        if(DEVEL){
            System.out.println(message);
        }
    }
}

My question is, will java compile out the print statements. i.e. if the devel tag is false, the messages will obviously not print but will they be included in the class files (devel is final). This is a question of efficiency. I’ve heard that the java compiler is very smart but will it pick up on this.

  • 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-23T02:33:07+00:00Added an answer on May 23, 2026 at 2:33 am

    use the ‘final’ attribute (as you did), and it will compile out the code:

    public static final boolean DEVEL = false;

    You can check by grepping the resultant class file for a string that would appear only if the code were compiled.

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

Sidebar

Related Questions

I am developing a dynamic web project j2ee web application using eclipse. I have
I am developing a evaluation system. I have set up a dynamic web project
So I'm developing something that works on dynamic variables using C# 4. And I'm
I'm developing a web page for a customer using the Silverlight application for dynamic
Using aspnet, c# 3.5, developing in vs2008. Using IE7. I have a web page
i am using eclipse helios 3.6 and i am developing JSF pages (Dynamic Web
Hi i am developing android application. I that i have creating the dynamic table
I'm developing a dynamic website using jQuery and I have found several jQuery plugins
I'm developing a dynamic data web app. On list.aspx page it has GridViewPager control
I'm developing a web service whose methods will be called from a dynamic banner

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.