Multiple Choice Question

Quiz Guidelines

 

QID: 
356
Question: 

What will the following code print when compiled and run:

public class TestClass {        
public static void main(String[] args){     
   int k = 2;    
    while(--k){         
   System.out.println(k);     
   }  
  } }

Select 1 option

A. 1 
B. 1 0 
C. 2 1 
D. 2 1 0 
E. It will keeping printing numbers in an infinite loop. 
F. It will not compile.

Q&A Set: