How can I create a java program that reads from the user a number and searches for that number in an array? : <p>This is the code which I've tried so far: </p>

<pre><code>int num;
       int[] a={2, 3, 4,7, 9};
       System.out.println("enter a no");
       for(int i=0; i&lt;a.length; i++){
           num= in.nextInt();
           if(num==a[i])
</code></pre>
