title: Combining substrings in Java
body: <p>I have this problem wherein the taken characters from the strings must combine in order to generate a unique pass code based on the user inputs. I'm currently stuck in coding, please help me: here's the code: </p>
  
  <pre><code>import java.util.Scanner;
  
  class GetInputFromUser{
  
     public static String a;
     public static Scanner in ;
  
     public static void main(String args[]) {
  
        String s;
        String y;
        String p;
  
        in = new Scanner(System.in);
  
  
  
          System.out.println("LastName: ");
          s = in.nextLine();
          String trimmeds = s.substring(0, 3);
          System.out.println(trimmeds); 
  
           System.out.println("FirstName: ");
           y = in.nextLine();
  
          String trimmedy = y.substring(y.length() -3);
          System.out.println(trimmedy); 
  
          digit();
          if (!(a.length()==8)){
          System.out.println("error");
          digit();
  
        }
  
       }
          public static void digit(){
          System.out.println("8-digit ID Num.: ");
          a = in.nextLine();
  
          String trimmeda = a.substring(a.length() -3);
          System.out.println(trimmeda); 
  
     }
  
  }
  </code></pre>
  
  <p>Here's the output of the program:</p>
  
  <p>LastName: 
  Dizon</p>
  
  <p>Diz</p>
  
  <p>FirstName: 
  Kristen</p>
  
  <p>ten</p>
  
  <p>8-digit ID Num.: 
  12345678</p>
  
  <p>678</p>
  
  <p>I need help in combining "Diz", "ten", and "678".</p>
  
  <p>the last output should be "Dizten678".</p>