onetwenty8k
2[H]4U
- Joined
- Nov 24, 2006
- Messages
- 2,554
I don't know why but I just can't seem to grasp logical operators, they simply don't seem logical to me.
A simple example that I just can't seem to grasp is if I want to have a condition where an integer has to be less than x or greater than y. I just don't see how this doesn't work, please enlighten me.
A simple example that I just can't seem to grasp is if I want to have a condition where an integer has to be less than x or greater than y. I just don't see how this doesn't work, please enlighten me.
Code:
Scanner console = new Scanner(System.in);
int num;
do {
System.out.print("Enter a number: ");
num = console.nextInt();
} while (num < 20 || num > 60);