Want more features on Pastebin? Sign Up, it's FREE!
Guest

asdjlh

By: a guest on Dec 19th, 2012  |  syntax: Java  |  size: 0.54 KB  |  views: 66  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. import java.util.*;
  2. public class Classname
  3. {
  4.         public static void main (String[] args)
  5.         {
  6.                 Scanner in = new Scanner(System.in);
  7.                 System.out.print("An integer between 1 and 10: ");
  8.  
  9.                 try {
  10.                         int x = in.nextInt();
  11.                         int y = testmetod(x);
  12.                 }
  13.                 catch (Exception e){
  14.                         System.out.println("The variable is out of bounds.");
  15.                 }
  16.  
  17.         }
  18.  
  19.         public static int testmetod(int z) throws Exception
  20.         {
  21.                 if (z < 1||z > 10){
  22.                         throw new Exception("Variable is not within range.");
  23.                 }
  24.                 else if () {  // <--------------------
  25.                 }
  26.         }
  27.  
  28.  
  29. }
clone this paste RAW Paste Data