title: How can i access an object from another method in java?
body: <p>I have the object numberlist that i created in create() method and i want to access it so i can use it in the question() method.</p>
  
  <p>Is there another way to do this that I probably missed? Am I messing something up? If not, how should I do this to get the same functionality as below?</p>
  
  <pre><code>private static void create() {
      Scanner input = new Scanner(System.in);
  
      int length,offset;
  
      System.out.print("Input the size of the numbers : ");
       length = input.nextInt();
  
       System.out.print("Input the Offset : ");
       offset = input.nextInt();
  
      NumberList numberlist= new NumberList(length, offset);
  
  
  
  
  }
  
  
  private static void question(){
      Scanner input = new Scanner(System.in);
  
      System.out.print("Please enter a command or type ?: ");
      String c = input.nextLine();
  
      if (c.equals("a")){ 
          create();       
      }else if(c.equals("b")){
           numberlist.flip();   \\ error
      }else if(c.equals("c")){
          numberlist.shuffle(); \\ error
      }else if(c.equals("d")){
          numberlist.printInfo(); \\ error
      }
  }
  </code></pre>