Sorry for posting in the wrong section, i knew the code was not a loop, but i did not know it was a control statement. I'm not sure how you supposed to know these things when you're a total noob, tbh, but hey ho.
Thank you for your replies, it worked a treat, but how come this doesn't work the same way. If you enter a number you get a specific answer, but i want it so if you enter anything else, like a character, you get the last 'else' output.
import java.util.Scanner;
public class Positive {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int num;
System.out.println("Enter number");
num = input.nextInt();
if (num < 0) {
System.out.println("This is a negative number");
}
else if (num == 0) {
System.out.println("Zero");
}
else if (num > 0) {
System.out.println("This is a postive number");
}
else {
System.out.println("Please enter a valid number");
Thanks in advance.