Home » JAVA Programming » Methods » Question
  1. What is the output of this program?
    public class Result 
    {
    public static void main(String args[])
    {
    long start, end;
    start = System.currentTimeMillis();
    for (int k = 0; k < 10000000; k++);
    end = System.currentTimeMillis();
    System.out.print(end - start);
    }
    }
    1. 0
    2. 1
    3. 200
    4. 30
    5. System Dependent
Correct Option: E

end time is the time taken by loop to execute it can be any non zero value depending on the System.



Your comments will be displayed only after manual approval.