A developer has the controller class below.

Which code block will run successfully in an execute anonymous window?
A developer has the controller class below.
Which code block will run successfully in an execute anonymous window?
The code block will run successfully because in Apex, when an object is instantiated, any uninitialized instance variables default to null. Since the 'prop' property is of type Integer and is not explicitly assigned a value in the constructor or elsewhere in the class, its default value will be null. Therefore, the assertion 'System.assert(m.prop == null)' will evaluate to true.
c is correct answer The reason is that the value of prop variable is never defined in the constructor of controller hence it is null
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_variables.htm
All the code will run successfully, but not all of them will return true.. But yes C would be correct if we solve for true
If you declare a variable and don't initialize it with a value, it will be null. In essence, null means the absence of a value.