Constant folding optimization

Can you differentiate between line A and line B in the following code snippet?

public class TestClass {
    static final  int a = 2;
    static final  int b = 3;

    static int c = 2;
    static int d = 3;

    public static void main(String[ ] args) {
	int product1 = a * b;             //line A
	int product2 = c * d;             //line B
    }
}

Line A, evaluates the product at compile-time, and Line B evaluates the product at runtime. If you use a Java Decompiler (e.g. jd-gui), and decompile the compiled TestClass.class file, you will see code as shown below.

public class TestClass 
{
    static final int a = 2;
    static final int b = 3;
    
    static int c = 2;
    static int d = 3;

    public static void main(String[ ] args)
    {
	int product1 = 6;
	int product2 = c * d;
    }
}

The Java compiler uses Constant folding technique for code optimization. Since final variables cannot change, they can be optimized. Javap command and Java Decompiler are handy tool for inspecting the byte code (i.e. compiled code).