answerWhat will be the output of the following Java program?class output_odd { public static void main(String args[]) { int p = 2; int q = 0; for ( ; q < 8; ++q) { if (q % p == 0) continue; else if (q == 6) break; else System.out.print(q + " "); } } }
Question
answerWhat will be the output of the following Java program?class output_odd { public static void main(String args[]) { int p = 2; int q = 0; for ( ; q < 8; ++q) { if (q % p == 0) continue; else if (q == 6) break; else System.out.print(q + " "); } } }
Solution
The output of the given Java program will be "1 3 5 ". Here's the step by step explanation:
- The program starts
Similar Questions
Select the correct answerWhat will be the output of the following Java program?class java { public static void main(String args[]) { int w = 5; int x = 10; first: { second: { third: { if (w == x >> 1) break second; } System.out.println(w); } System.out.println(x); } } }Options5 1051010 5
ect answerWhat will be the output of the following Java program?class java { public static void main(String args[]) { int var1 = 3; int var2 = 8; if ((var2 = 2) == var1) System.out.print(var2); else System.out.print(++var2); } }
e correct answerWhat is the output of the following Java program?class Main { public static void main(String args[]) { final int i; i = 20; i = 30; System.out.println(i); }}
What is the output of the following Java program?
What is the output of the following Java code?Code:class HackerEarth{ public static void main(String[] args) { int val = 1; while((val<=5 ? val++: --val)<5) { System.out.print("MAC"); } if(val>5); System.out.print("PC"); }}
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.