Java How to loop until variable is equal to a specific type (String/int)
<p>Hi I'm currently developing a small booking program, I'm curios to know if i can use a Loop to run until a variable is equal to a specific type, notably a String or An Integer. 
For example i have the following below, and I want the user to always enter a number.</p>

<p>If not, am i right in presuming i should just develop a try/catch etc.?</p>

<p>Regards.</p>

<pre><code>  public int SetHouseNo(){   
  System.out.println();        
  System.out.print("Please enter your house number:   ");    
  HouseNo=in.nextInt();
  return HouseNo; 
  }
</code></pre>
