If I have the following code:
public class Test {
private int x = 5;
private static int y = 5;
public Test() {
x = 10;
y = 10;
}
}
I'm wondering in both cases will it actually initially assign 5, and then update this with 10, in other words, there's no point initialising a variable inline and in a constructor as it actually has the effect of initialising a variable twice? Or in the case of x (being an instance field) does it just replace x = 5 with x = 10 and therefore only even run x = 10?
It would be nice to know the decompiled version.