Question: What happens if the following code is compiled and executed within a program? int cnt = 0 ; while ( 1 ) { + +

What happens if the following code is compiled and executed within a program?
int cnt =0;
while (1){
++cnt;
System.out.println ("cnt ="+ cnt);
}
Group of answer choices
The code will not compile.
An exception will be thrown
The code completes with no output
The code goes into an infinite loop
None of the other options is correct.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!