title: Substring Method
body: <p>I had to write this program to output the first letter of a first name and the first five letters of the last name plus a random number from 10-99. It works but I thought that the substring method starts at 0 and goes from there so that substring(0,0) would include just the first letter and likewise substring(0,4) would include 0 1 2 3 4 letters for the first 5. Or does it not include the final number in the output?</p>
  
  <pre><code>import java.util.Scanner;
  import java.util.Random;
  
  public class NameModifier
  {
  
  public static void main (String[] args)
      {
  
      String namefirst;
      String namelast;
      Random generator = new Random();
      int num;
  
      num = generator.nextInt(99) + 10;
  
      Scanner scan = new Scanner (System.in);
  
      //prompts user
      System.out.print ("Enter your first name: ");
      namefirst = scan.nextLine();    
      System.out.print ("Enter your last name: ");    
      namelast = scan.nextLine();
      System.out.println("Your entered: " + namefirst + " " + namelast);
  
      //outputs modified username possibility
      System.out.println("Here is a random username for you: ");
      System.out.print (namefirst.substring(0, 1));
      System.out.print (namelast.substring(0,5));
      System.out.print (num);
  
      scan.close();
  
      }
  }
  </code></pre>