Exam 1z0-811 All QuestionsBrowse all questions from this exam
Question 11

Given:

What is the result?

    Correct Answer: A

    When a new instance of the Student class is created, the instance variables sName and grade are assigned default values because they are not explicitly initialized. In Java, the default value for an uninitialized String is null, and the default value for an uninitialized char is the null character, which is represented as '\u0000'. This null character is typically invisible in the output, effectively displaying as an empty character. Therefore, the output of the code will be '[null:]'.

Discussion
filco72Option: A

Correct answer is missing, I tested the snippet and it returns: [null:] not initialized char returns a empty char not a '-'

supercoderOption: A

Correct answer A with modification to [null:]

tombatossalsOption: A

Correct answer is A. A String variable will be null if not defined, but char is a primitive type so is will not be null, it will be and empty char