title: Scanner.scan / initializing variables
body: <p>I'm having a simple little problem, I need to have the variable "age" be read from the scanner.scan, where the user inputs a number. It keeps telling me to initialize it, but in order to do that I need to provide the variable with a set whole number, which I don't want to do. How could I fix this?</p>
  
  <pre><code>import java.util.*;
  
  import java.io.*; 
  
  import java.util.Scanner;
  
  public class Person
  
  {
  
      public static void main(String[]args) 
  
      {
  
      int age;
  
      Scanner scan = new Scanner(System.in);
  
      System.out.println("Enter in your age.");
  
       if (age &lt; 18) 
  
       {
           System.out.println("Youth is a beautiful thing.");
       } 
  
       else
  
       {
          System.out.println("Age is just a state of mind.");
       }
  
  
  }
  }
  </code></pre>