I know if it was a primitive type array, such as an int, it would be 0s, but as an object, such as a String or a custom-made class, is it still 0? NULL? Or what?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It’s always the default value for the element type –
nullfor any class types, 0 for numeric types,'\0'forcharandfalseforboolean. (NULLdoesn’t exist in Java, and 0 is a meaningless value for a reference. It may be the physical representation in memory, but it’s not a reference value in itself.)See section 15.10.1 of the JLS for how array creation works, and section 4.12.5 for more explicit detail on the default values of different types.