title: Returns null when calling method in another class
body: <p>Very simple question but very little luck.</p>
  <p>My problem is that when I attempt to call on get methods <code>getUserID</code> and <code>getPassword</code> of class <code>User</code> in class <code>Login</code>, I get null.</p>
  <p>I have looked at other posts with a similar problem to mine. Although I found few posts to guide me, a common issue was that the poster had not initialised the class object but I have done that.</p>
  <p>I need specific code here because I've tried a lot of things but can't get it to work. I hope that I provided enough info to help you assist me.</p>
  <h1>User class</h1>
  <pre><code>public class User 
  {
  private String userID;
  private String password;
  private Employee employee;
  private String authorityLevel;
  /**
   * Constructor for User class - Initialise a fixed password and employee object.
   */
  public User()
  {  
      employee = new Employee();
      password = &quot;password&quot;;
  }    
  
  /**
   * Create a user ID and print the user the details of their user account.
   */
  public void createUser(Employee employee)
  {  
      // Combine staff ID with authority key to make the user ID.
      userID = employee.getID() + &quot;&quot; + employee.getAuthorityLevel();
      
      // Check that there is a staff ID to create the user ID.
      // It also ensures that an employee profile has been created before an attempt
      // to make a user account.
      if(employee.getID() == null){
          System.out.println(&quot;There are no Employee details to make a User with.&quot;);
          System.out.println(&quot;Please enter the Employee details before you make a user&quot;);
      }
      else{
          System.out.println(&quot;Your user ID is: &quot;+userID);
          System.out.println(&quot;Your user password is: &quot;+password);
      }
  }    
  
  /**
   * @return The user ID.
   */
  public String getUserID()
  {
      return userID;
  }
  
  /**
   * @return The password.
   */
  public String getPassword()
  {
      return password;
  }  
  }
  </code></pre>
  <p>I want to access the userID and password getter methods in the User class to use in the Login class.</p>
  <h1>Login class</h1>
  <pre><code>public class Login
  {
  private User user;  
  private boolean accessGranted;
  private String userID;
  private String password;   
  private boolean loggedIn;
  private boolean loggedOut;
  /**
   * Constructor for the Login class - initialise a user object.
   */
  public Login()
  {   
      user = new User();
  }   
  
  /**
   * Attempt to start a login session.
   */
  public void login(String userID,String password)
  {   
      // Check that credentials entered are correct for the account the user wishes to log in to.
      if((password == user.getPassword()) &amp;&amp; (userID == user.getUserID())){
          accessGranted = true;
          if((accessGranted == true) &amp;&amp; (userID.contains(&quot;H&quot;))){
              System.out.println(&quot;Your login session has started.&quot;);
              System.out.println(&quot;You are now viewing Yuconz System as HR staff.&quot;);
          }
          if((accessGranted == true) &amp;&amp; (userID.contains(&quot;D&quot;))){
              System.out.println(&quot;Your login session has started.&quot;);
              System.out.println(&quot;You are now viewing Yuconz System as Director staff.&quot;);
          }
          if((accessGranted == true) &amp;&amp; (userID.contains(&quot;E&quot;))){
              System.out.println(&quot;Your login session has started.&quot;);
              System.out.println(&quot;You are now viewing Yuconz System as Employee staff.&quot;);
          }
          loggedIn = true;
      }
      else{
          System.out.println(&quot;ACCESS DENIED BRUTHA!&quot;);
      }
  }    
  </code></pre>
  <p>One class creates the user account where the only details are a userID and a password. The other class is where the user can use the details of that account to login. In <code>Login</code>'s <code>login</code> method I am checking that the ID and password entered match the ID and password of the account that they are trying to access.</p>