title: Setting a scanner as a global variable
body: <p>Method at the top, is it declared as a global variable as its not actually taking in anything.</p>
  
  <pre><code> public class java_1 {
  
     static Scanner stdin = new Scanner(System.in);
  
  import java.util.Scanner;
  </code></pre>
  
  <p>Thats the code used to declare it, if you can declare it another way could i get a link to the documentation.</p>
  
  <pre><code>public class java_1 {
  
     static Scanner stdin = new Scanner(System.in);
  
     static String getLastName (String Name){
         String lastName;
         int spacePos,length;
  
         spacePos = fullName.indexOf("");
         length = fullName.length();
         lastName = fullName.substring(spacePos + 1);
         return lastName;
     }
  
  
     static String getInitial (String fullName){
         String initial;
         initial = fullName.substring(0,1); 
         return initial;
  
     }
      static String =Name (){
  
         String fullName;
         String userName;
         String initial;
         String lastName;
  
            System.out.println("name");
            fullName = stdin.nextLine();
  
            initial = getInitial(fullName);
            lastName = getLastName(fullName);
  
            userName = initial + lastName;
  
            System.out.println(userName);
            return userName;
        }
  
  static String printuserName (){
  
         String fullName,userName,initial,lastName;
  
            System.out.println("enter name");
            fullName = stdin.nextLine();
  
            initial = getInitial(fullName);
  
            userName = initial + lastName;
  
            System.out.println("username: " + userName);
            return userName;
        }
  
  
     static int menu(){
  
            int choice;
              System.out.println("Input a number from the table, corresponding to the task required");
              System.out.println("1 = User name");
              System.out.println("2 = Factor");
              System.out.println("3 = Quit");
  
              choice = stdin.nextInt();
  
              while (choice != 1){
                  System.out.println("Re enter");
                  choice = stdin.nextInt();
          }
              return choice;
     }
  
  
  
  
        }
       }
      }
  </code></pre>