0

I have a static class, with all methods and fields static. My methods in that class are going to use a static field declared in that class.

I want that static variable(which can not be made final) to be initialized with a value taken from a database when that static class is accessed for the first time. And this variable should not be initialized later on in any case.

2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by warlord902
0

By using a Static Initialization Block.
Just check this tutorial

Oh yeah....how did I forgot this, its so stupid of me...Thanks buddy :)

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.