title: How to print a String defined in one class in a different class?
body: <p>I have two classes. In the first one, I used the <code>Scanner</code> to retrieve the user's name and then store it in a <code>String</code> called <code>name</code>. Then say, I start a new class, and want to print that came out, how do I go about it. So I just wrote up this code as an example, so you can get an idea of what I'm trying to ask. I'll post both classes.  </p>
  
  <pre><code>import java.util.Scanner;
  
  public class One {
      public static void main(String[] args) {
  
          String name;
          String start;
          Scanner input = new Scanner(System.in);
  
          System.out.println("Hello, what is your name?");
          name = input.nextLine();
  
          System.out.println("Hello "+name+", welcome! To ocntinue, please hit any key.");
          start = input.nextLine();
  
          if(start != null){
              Two object = new Two();
          }
  
      }
  }
  </code></pre>
  
  <p>Second class.</p>
  
  <pre><code>public class Two {
      public Two() {
          System.out.println("Ok "+One.name+", lets start!");
      }
  }
  </code></pre>