title: Unable to exit from while loop
body: <pre><code>Integer[][] a = new Integer[3][3];
  int value1=1;
  
  while(a !=null) {   
      System.out.println("Please enter the value of indexes");
      i=input.nextInt();
      j=input.nextInt();
  
      int value= input.nextInt();
      if(!(i&lt;0||i&gt;2 &amp;&amp; j&lt;0 || j&gt;2)) {
          if(a[i][j]== null) {
              a[i][j]=value;
              System.out.printf("value of a[%d][%d] =%d",i,j,a[i][j]);
          }
          else {
              System.out.println("Index already has value");
          }
      }
      else {
          for(i=0;i&lt;3;i++) {
              for(j=0;j&lt;3;j++) {
                  System.out.println(a[i][j]);
              }
          }
      }
  </code></pre>
  
  <p>i have made a check against a in while i want to leave the loop when all the elements of loop gets a value but its not working </p>