title: Age Exception error in Java
body: <p>I've created a program to ask the user to their name and age, and I've made a custom exception but it won't initiate any tips on how to make it better or how to get the exception to initiate correctly is appreciated but take note I'm still learning java.</p>
  
  <p><strong>User-Defined Exception</strong>: (Age Exception)</p>
  
  <pre><code>    package ageName;
  
      @SuppressWarnings("serial")
      public class AgeExcpt extends Exception {
  
           public AgeExcpt(){     
           super("The Age you've entered is not valid");       
      }
    }
  </code></pre>
  
  <p><strong>Main Program</strong>:</p>
  
  <pre><code>package ageName;
  
  import java.util.Scanner;
  
  @SuppressWarnings("resource")
  public class Project1 {
      public static void main(String[]args){
  
        Scanner age = new Scanner (System.in);
        System.out.println("Enter your age");
        int a = age.nextInt();
        System.out.println("Enter you name");
        String b = age.next();
  
    try{  
       if(a &gt;125 &amp;&amp; a&lt;0){         
          throw new AgeExcpt();
       }          
      }
      catch(AgeExcpt ex){
      System.out.println("You entered an invalid number" + a);        
      }
      finally{
          System.out.println("Your age is " + a);
          System.out.println("Your name is " + b);
      }   
  }
  }
  </code></pre>