public class One { public int getVar() { return var; } public void setVar(int theVar) { var = theVar; } private int var; } public class Two { public static void main(String[] args) { One obj = new One(); System.out.println(obj.getVar()); } }
(a) The compiler will complain that var isn't initialised. (b) The compiler will complain that the program tries to access var, which is private. (c) The compiler will say that var is local to the method getVar() and therefore cannot be used in method setVar(). (d) There are no problems.
var
private
getVar()
setVar()
Select all correct answers.