Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Can someone help me figure out what I\'m doing wrong here? I\'ve used the || ope

ID: 3901124 • Letter: C

Question

Can someone help me figure out what I'm doing wrong here? I've used the || operator but it keeps giving me a syntax error...I'm new at this and I'm probably leaving a semicolon or something out, lol! This is JAVA, btw!

Write an expression that prints "Special number" if specialNum is -99, 0, or 44.

import java.util.Scanner;

public class FindSpecialValue {
public static void main (String [] args) {
int specialNum = 0;

specialNum = 17;

if (/*Insert answer here*) {
System.out.println("Special number");
}
else {
System.out.println("Not special number");
}

return;
}
}

Explanation / Answer

FindSpecialValue.java

import java.util.Scanner;

public class FindSpecialValue {
public static void main (String [] args) {
int specialNum = 0;

specialNum = 17;

if (specialNum==-99 || specialNum==0 || specialNum==44) {
System.out.println("Special number");
}
else {
System.out.println("Not special number");
}

return;
}
}

Output:

Not special number

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote