Loading
Perform one time activities in a java Class

Java Quick Notes

Refresh Your Java - Before Java Interview

We are Agile, believe in less Documentation - Only Quick notes (Java Interview Questions) of Java/J2ee Read more....


Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet

Go to SiteMap

Q)  How to perform one-time activities in a java Class ?


Ans)

You have to use

i) Static block to perform one-time activities in a java Class as shown below.

  public class YourJavaClass
{
static{
      baseDir = AppConfigManager.getAppConfigManager().getClientConfig("basedir").trim();
      if(!baseDir.endsWith("/")){
        baseDir = baseDir + "/";
      }
    }

 
}

ii) Use Singleton class as shown above.

 



Back to top

------------------------- We hope you got necessary Info On -----------------------------------------

Perform one time activities in a java Class


Perform one time activities in a java Class

-------------------------------------------------------------------------------------------------------



Face Book
Request for a Mock Interview/Training

Get a PDF

Face Book
Same look (Read) on any device, this is Ads free