Brilliant! Glad I could help Luke.
If you have no further questions, please can you mark this thread as solved. (Check the link in my signature)
Thanks!!
Type: Posts; User: JavaPF
Brilliant! Glad I could help Luke.
If you have no further questions, please can you mark this thread as solved. (Check the link in my signature)
Thanks!!
This can easily be done with an if statement:
if(yourInt > 0 && yourInt <= 40){
System.out.println("Your value is greater than 0 and less or equal to 40");...
Take a look at this luke.
If the user enters a non Integer value, the exception is caught and the ScannerStuff() method is run again.
The 2 Integers myInt & yourInt are compared once a user...
Yes there is. You can use a while loop:
import java.util.Scanner;
public class Main2 {
public static void main(String[] args) {
Hello luke,
The reason you are getting this error is because you are using int name = sc.nextInt();
For a start, the variable 'name' is an Integer so needs to have an Integer value assigned.
...