import java.util.*;
public class Classname
{
public static void main (String[] args)
{
Scanner in = new Scanner(System.in);
System.out.print("An integer between 1 and 10: ");
try {
int x = in.nextInt();
int y = testmetod(x);
}
catch (Exception e){
System.out.println("The variable is out of bounds.");
}
}
public static int testmetod(int z) throws Exception
{
if (z < 1||z > 10){
throw new Exception("Variable is not within range.");
}
else if () { // <--------------------
}
}
}