Bram Yeh
1 min readMay 4, 2019

Yes, static initialization blocks are kind of lazy initializers. They will execute when static methods are called or there is a reference to the class.

Just in most of generally thinking, lazy initializer looks like

public static Instance getInstance() { 
if (instance == null) {
instance = new Instance();
}
}

we don’t hit upon static initialization block.

We might just load the class first but use instantiated object later, or never. (but I know this case is much rare.)

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Bram Yeh
Bram Yeh

Written by Bram Yeh

Lead Android & iOS Mobile Engineer at Yahoo (Verizon Media) Taiwan https://www.linkedin.com/in/hanruyeh/

No responses yet

Write a response