Hier habe ich ein Programm, wenn ich die constant
druckt in main
static
Block nicht ausführt .. aber wenn ich stat
drucken, die jede Bedeutung static final
in Java ist es führt ..? bitte erklärenWarum Code im statischen Block nicht ausgeführt wird?
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);
}
}
Danke .. :) Jetzt habe ich klar .. – jenuine