title: How to get a string from another class?
body: <p>Searched everywhere trying to find how to do this.
  I want to get a string from one class that i set the variable before going into the second class and allow me to use it as a string in this class. </p>
  
  <p>Basically there's a String called LastName that i want to use in another class.</p>
  
  <p>Here's my code if needed.</p>
  
  <p>First Login Class:</p>
  
  <pre><code>import java.util.Scanner;
  
  public class Login {
  public void LoginScreen() {
  
      Agent AgentObject = new Agent();
      Citizen CitizenObject = new Citizen();
  
      String FirstName;
      String LastName;
  
      Scanner input = new Scanner(System.in);
  
      System.out.println("Welcome!");
      System.out.print("Please Enter Last Name: ");
      LastName = input.next();
      System.out.print("Please Enter First Name: ");
      FirstName = input.next();
      System.out.println("Hello " + FirstName + " " + LastName);
  
      System.out.print("Enter Password: ");
      String userinput = input.next();
      if (userinput.equals("Timmo")) {
          AgentObject.WelcomeAgent();
      } else {
          CitizenObject.WelcomeCitizen();
      }
  
  }
  }
  </code></pre>
  
  <p>Second Agent Class:</p>
  
  <pre><code>public class Agent {
  public void WelcomeAgent() {
      Welcome WelcomeObject = new Welcome();
      Login LoginObject = new Login();
  
      System.out.println("Access Granted");
      System.out.print("Loading Data  ");
      int progress = 0;
      while (progress &lt;= 100) {
          System.out.print(progress + " ");
          progress++;
      }
      System.out.println("    Data Loaded");
  
      System.out.println("Welcome Agent " + LastName);
      LoginObject.LoginScreen();
  }
  }
  </code></pre>
  
  <p>Any help is incredibly appreciated. Thanks </p>