Which code can be inserted to have the code print 2?
public class Main { private int myNumber; boolean call; public Main() { // LINE 1 call = false; // LINE 2 } public Main(int myNumber) { this.myNumber = myNumber; } public static void main(String[] args) { Main m = new Main(); System.out.println(m.myNumber); } }
E.
A and B will not compile because constructors cannot be called without new.
C and D will compile but will create a new object rather than setting the fields in this one.
F will not compile since this() must be the first code line inside constructor.