title: License plate number verification program JAVA
body: <p>I'm trying to write a small program that reads in a license plate number from the user and returns if it is valid or not. I'm not quite sure on how to loop through it to see if certain characters are correct.</p>
  
  <p>Note: This is suppose to be an Icelandic license number plate.</p>
  
  <p>With Icelandic license number plates, the first 2 characters are capital strings. the 3rd character can be either a capital letter or a number, and the last 2 must be numbers as well. Here is an example of a valid license plate: "HX567".</p>
  
  <p>Anyway, here's my code so far, hopefully someone here can show me how to loop through the string and check if the first 2 characters are letters and capital etc.....</p>
  
  <pre><code>import java.util.Scanner;
  import java.util.*;
  
  public class Bilnumer {
  
      public static void main(String[] args) {
          Scanner skanni = new Scanner(System.in);
  
          System.out.println("Good day, please enter your license plate number.");
          System.out.println("License plate number: ");
          String bilnumer = skanni.nextLine();
  
          bilnumer = bilnumer.toUpperCase();
  
          int lengd = bilnumer.length();
  
          if (lengd &gt; 5)
          {
              System.out.println("License plate numbers can not be more then 5 characters");
          }else{
              System.out.println("Your license plate number is: "+bilnumer);
          }
  
  
      }
  
  }
  </code></pre>