Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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 () { // <--------------------
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement