title: Java error: "incompatible types" message
body: <p>I am getting an error in Java during compilation:</p>
  
  <pre><code>UserID.java:36: error: incompatible types
              + generator.nextInt(10);
              ^
    required: String
    found:    int
  </code></pre>
  
  <p>Here is the Java code:</p>
  
  <pre><code>public class UserID {
  
    private String firstName; 
    private String userId;  
    private String password;
  
    public UserID(String first) {
       Random generator = new Random();
  
       userId = first.substring(0, 3) + 
          + generator.nextInt(1) + 
         (generator.nextInt(7) + 3) + generator.nextInt(10);     //this works
  
       password = generator.nextInt(10) + generator.nextInt(10);   //Error is here
  
    } 
  }
  </code></pre>
  
  <p>What is the reason for this error and how do I fix it?  Why is it not automatically promoting the int to a String?</p>