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

Identify two valid data types for the operands of the addition (+) operator?

    Correct Answer: A, C

    The addition operator (+) is used to add numbers (numeric data type) and to concatenate strings (string data type). Boolean and array types are not valid operands for the addition operator. Therefore, the valid data types for the operands of the addition operator are string and numeric.

Discussion
nmkkrtcgOptions: AC

'+' operator in java can be used to add numbers and concatenate strings. Following rules should be considered. Only numbers as operands then result will be a number. Only strings as operands then result will be a concatenated string. so logically the answer is A (string) and C (numeric) because it says valid data type, array is not a data type right?

tabrezshaikh13Options: AC

A and C are the correct answer.

CuriosityYenOptions: AC

In Java, the addition operator + is used for adding numerical values or concatenating strings.