I got it to this but I'm struggling with the 0 and null and the end 6 and First name Thanks
static void init()
Static block
public static void main
Non-static block
static void printAllFields
null
0
Solution constructor
static void printAllFields
First name
6
package com.codegym.task.task15.task1524;
/*
Order of loading variables
*/
public class Solution {
public int i = 6;
static {
init();
}
{
System.out.println("Non-static block");
printAllFields(this);
}
static {
System.out.println("Static block");
}
public String name = "First name";
public Solution() {
System.out.println("Solution constructor");
printAllFields(this);
}
public static void init() {
System.out.println("static void init()");
}
public static void main(String[] args) {
System.out.println("public static void main");
Solution s = new Solution();
}
public static void printAllFields(Solution obj) {
System.out.println("static void printAllFields");
System.out.println(obj.name);
System.out.println(obj.i);
}
}