Computer Science, asked by clomarina0, 9 months ago

Consider the following code segment.

String a = "";

a += "0";

if (a == "0") {

System.out.println("a is 0!");

} else if (a == "1") {

System.out.println("a is 1!");

} else if (a == "a") {

System.out.println("a is a!");

} else {

System.out.println("a is something else!");

}

Which of the following statements about the code segment is true?

a. It produced "a is 0!" as output incorrect
b. It produced "a is 1!" as output
c. It produced "a is a!" as output
d. It produced "a is something else!" as output
e. It results in an error because the == operation can not be used with Strings

Answers

Answered by sakshidabral27
1

Answer:

well, the output would be a is 0.

so, in the question (a) part is written wrong cuz that will be the answer

Similar questions