Why code in static block does not execute?
java
Solution
The `static final int` will get compiled directly into your code as its value. That is to say, the JVM sees and is executing:
System.out.println(123);
and you're not touching your aptly-named `Doubt` class at all (this is an argument for not specifying constants in this fashion, btw. If you change that value you have to recompile every referencing class)
Problem
When I print the `constant` in `main`, the `static` block does not execute, but when I print `stat`, it does execute. Is there any importance to `static final` in Java? ``` package com.test.doubt; class Doubt { public static final int constant = 123; public static int stat = 123; static { System.out.println("Static Block"); } } public class MyProgram { public static void main(String[] args) { System.out.println(Doubt.constant); } } ```