Show the output of the following program: public class StrangeClass { public sta
ID: 3616985 • Letter: S
Question
Show the output of the following program:
public class StrangeClass
{
public static void main(String[]args)
{
int num=0;
while(num <= 29)
{
if (strange(num))
System.out.println("True");
else
System.out.println("False");
num = num + 4;
}
}
public static boolean strange(int n)
{
if (n % 2== 0 && n % 3 == 0)
return true;
else
return false;
}
}
Explanation / Answer
please rate - thanks num=0 is numRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.