🎴 Flashcard Mode
Java Programming Fundamentals
Card1 / 20
Mastered0
Review0
QuestionClick to flip
How long does the following code run? for(int x=0; x=3; x++)
AnswerClick to flip back
A
Forever
💡 Explanation:
The loop condition x=3 uses the assignment operator = instead of the comparison operator ==. The assignment expression evaluates to 3, which is treated as a truthy value in C/C++. Because this condition is always true, the loop will execute infinitely (forever).