Java – is initialization the same as null initialization?
•
Java
If you declare such an object:
Object x;
Does it initialize to null?
For example, is will (x = = null) true?
Solution
If x is a field, it will be null by default If it is a local variable, it must be explicitly initialized before using it This is in JLS § 4.12 5: Initial values of variables
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码