Below is my code, wondering why null is printed instead of Hello World!!!
public class MyClass {
static String s1 = getMyValue();
static String s2 = "Hello World!!!";
private static String getMyValue() {
return s2;
}
public static void main(String args[]) {
System.out.print(s1); //outputs: null
}
}