title: Using Multiple Classes for a Clock in Bluej
body: <p>(<strong>Before I begin sorry for the large unorganized code, I'm still relatively new</strong>)</p>
  
  <p>I'm currently using BlueJ for a project of mine, and I need a timer to actually time each level of the game. I'm using the Try and Catch commands to actually have timer, and I'm trying to use two different classes, I was wondering if there is a better way to do this, or how would I go about referencing the two inside of each other. Thanks!</p>
  
  <pre><code>import java.util.Random;
  import java.util.Scanner;
  
  public class grid5x5{
  
  String a= "x";
  String b= "x";
  String c= "x";
  String d= "x";
  String e= "x";
  String f= "x";
  String g= "x";
  String h= "x";
  String i= "x";
  String j= "x";
  String k= "x";
  String l= "x";
  String m= "x";
  String n= "x";
  String o= "x";
  String p= "x";
  String q= "x";
  String r= "x";
  String s= "x";
  String t= "x";
  String u= "x";
  String v= "x";
  String w= "x";
  String x= "x";
  String y= "x";
  private int a1;
  private int a2;
  private int a3;
  public int a4=2;
  public void Grid(){
      while(a4==2){
      System.out.println('\f');
      Random rand = new Random();
      int z = rand.nextInt(25) + 1;
  
      if (z==1){
           a= "O";
             a1=11;
      }
      if (z==2){
           b= "O";
             a1=21;
      }
      if (z==3){
           c= "O";
             a1=31;
      }
      if (z==4){
           d= "O";
             a1=41;
      }
      if (z==5){
           e= "O";
             a1=51;
      }
      if (z==6){
           f= "O";
             a1=12;
      }
      if (z==7){
           g= "O";
             a1=22;
      }
      if (z==8){
           h= "O";
             a1=32;
      }
      if (z==9){
           i= "O";
             a1=42;
      }
      if (z==10){
           j= "O";
             a1=52;
      }
      if (z==11){
           k= "O";
             a1=13;
      }
      if (z==12){
           l= "O";
             a1=23;
      }
      if (z==13){
           m= "O";
             a1=33;
      }
      if (z==14){
           n= "O";
             a1=43;
      }
      if (z==15){
           o= "O";
             a1=53;
      }
      if (z==16){
           p= "O";
             a1=14;
          }
      if (z==17){
           q= "O";
             a1=24;
      }
      if (z==18){
           r= "O";
             a1=34;
      }
      if (z==19){
           s= "O";
             a1=44;
      }
      if (z==20){
           t= "O";
             a1=54;
      }
      if (z==21){
           u= "O";
             a1=15;
      }
      if (z==22){
           v= "O";
             a1=25;
      }
      if (z==23){
           w= "O";
             a1=35;
      }
      if (z==24){
           x= "O";
             a1=45;
      }
      if (z==25){
           y= "O";
             a1=55;
      }
      else{
  
      }
      System.out.println("  1 2 3 4 5");
      System.out.println("1 "+a+" "+b+" "+c+" "+d+" "+e);
      System.out.println("2 "+f+" "+g+" "+h+" "+i+" "+j);
      System.out.println("3 "+k+" "+l+" "+m+" "+n+" "+o);
      System.out.println("4 "+p+" "+q+" "+r+" "+s+" "+t); 
      System.out.println("5 "+u+" "+v+" "+w+" "+x+" "+y);
      System.out.println("Points: "+a2);
      System.out.println("Time: "+a3);
      int inVar;
      Scanner input = new Scanner(System.in);
      System.out.println("Enter the Coordinates: ");
      inVar = input.nextInt();
      if(inVar==a1){
          System.out.println('\f');
          System.out.println("CORRECT!");
          a2=a2+1;
      }
      else{
          a4=a4+1;
      }
  
       a= "x";
       b= "x";
       c= "x";
       d= "x";
       e= "x";
       f= "x";
       g= "x";
       h= "x";
       i= "x";
       j= "x";
       k= "x";
       l= "x";
       m= "x";
       n= "x";
       o= "x";
       p= "x";
       q= "x";
       r= "x";
       s= "x";
       t= "x";
       u= "x";
       v= "x";
       w= "x";
       x= "x";
       y= "x";
       System.out.println('\f');
  
      }
  
      System.out.println('\f');
      System.out.println("INCORRECT, Game Over");
      System.out.println("Total Points: "+a2);
      System.out.println("Thanks for playing!");
  }
  }
  </code></pre>
  
  <p>Here is my other block of code for the other class</p>
  
  <pre><code>public class Timer
  {
  public int a5=5000;
  
  public void timer(){
      while(a4==2) {
       try {Thread.sleep(1000);}
       catch (InterruptedException ie){}
       a5=a5-100;
       if(a5&lt;300){
           a5=300;
          }
       else
       {
       }
      }
  }
  }
  </code></pre>