×

Multiple-Choice Questions

Web Technologies MCQs

Computer Science Subjects MCQs

Databases MCQs

Programming MCQs

Testing Software MCQs

Digital Marketing Subjects MCQs

Cloud Computing Softwares MCQs

AI/ML Subjects MCQs

Engineering Subjects MCQs

Office Related Programs MCQs

Management MCQs

More

What will be the output of following Java code (2)?

22. What will be the output of following Java code?

public class Main {
  public static void main(String arg[]) {
    int i;
    for (i = 1; i <= 12; i += 2) {
      if (i == 8) {
        System.out.println(i);
        break;
      }
    }
  }
}
  1. 1
  2. No output
  3. 8
  4. 1357911

Answer: B) No output

Explanation:

The condition (i == 8) could not be satisfied hence nothing cannot be printed.

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.