Solved

What Is the Outcome of the Following Code Snippet? Boolean

Question 92

Multiple Choice

What is the outcome of the following code snippet? boolean val1 = true;
Boolean val2 = false;
While (val1)
{
If (val1)
{
System.out.println("Hello") ;
}
Val1 = val2;
}


A) No output will be displayed because of compilation error.
B) "Hello" will be displayed only once.
C) "Hello" will be displayed infinite times.
D) No output will be displayed even after successful compilation of the code snippet.

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents