- No, both examples are not equal. In example one the variable is initialized at construction time and class1cannot be instantiated without it. In example 2, the variable is not initialized and is given the default value ofnulluntil it is set at some later timesetVar1
- No, you will not get an exception. If you try to call getVar1before you callhandle, you will get the defaultnullvalue.
0
solved Proper variable initialization and call from another class