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
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.