What makes this line of code execute?
The code gives an output of 11, but I was expecting it to be 1
package methodcalling;
public class MethodCalling {
public static int cakes = 1;
public final static int UNIT = 10;
static{cakes += UNIT;} // what makes this line of code execute
public static void main(String[] args) {
System.out.println(cakes);
}
}