- Engineering
- Computer Science
- what would be printed when the following code is executed...
Question: what would be printed when the following code is executed...
Question details
What would be printed when the following code is executed?
if ( “string1” != “string2”)
System.out.println(“Strings are not equal”);
else
System.out.println(“Strings are equal”);
if ( “string1” != “string2”)
System.out.println(“Strings are not equal”);
else
System.out.println(“Strings are equal”);
a.
Strings are not equal
b.
Strings are equal
c.
Nothing is printed, as there is a syntax error.
d.
Nothing is printed, there is a runtime error.
Solution by an expert tutor
