You’re mixing up && and ||, so your first if will never run as mentioned in the comments.
So it looks like the only "Not Weird" print out is 2, 4 and even numbers > 20.
So use this to your advantage to just check for the "Weird" outputs, otherwise print "Not Weird".
if (n % 2 == 0) {
if ((n >= 2 && n <= 5) || (n > 20)) {
return "Not Weird";
}
}
return "Weird";
Having said this, I’m not sure what you want with Scanner::skip
2
solved Conditional Statement on Java7