Java Programming
primer-original-v2mediumJava Programming03 Class And Objects, Date Apiprimer-original-v2

Java Programming Practice Question

Predict the output. public class Test { public static void main(String args[]) { int a = 2, b = 0; for ( ; b < 20; ++b) { if (b % a == 0) continue; else if (b == 10) break; else System.out.print(b + " "); } } }

Answer options

A
1 3 5 7 9 11 13 15 17 19
B
Code executes but gives no output
C
0 2 4 6 8
D
Compile-time error

Correct answer: 1 3 5 7 9 11 13 15 17 19

Explanation

Quick AnswerThe correct answer is 1 3 5 7 9 11 13 15 17 19 because it directly addresses the core logic of Java Programming.

This question has been retained as-is due to its unique context.

Related Java Programming questions

Practice more Java Programming questions

PrimerPrep has independently reviewed practice questions and coding exercises — all free.