What is the result of compiling and executing the following
fragment of code:
Boolean flag = false;
if (flag = true)
{
System.out.println(“true”);
}
else
{
System.out.println(“false”);
}
- The code fails to compile at the “if” statement.
- An exception is thrown at run-time at the “if” statement.
- The text“true” is displayed.
- The text“false”is displayed.
- Nothing is displayed.