reading Array randomly
<p>I've a program &amp; I wont to read ARRAY randomly I don't have error with program
 but during output I have null value can you give me the solution ...</p>

<pre><code>import java.io.FileInputStream;
import java.util.Properties;
import java.util.Random;
import javax.swing.JOptionPane;

public class ReadDB {
    public static void main(String[] args) {

        Properties prob = new Properties();
        String word [] = new String [20] ;
        try{
            prob.load( new FileInputStream("words.txt"));
        }catch(Exception e){
        }
        for(int i=1; i&lt;6; i++){         
            String temp = prob.getProperty(""+i);
            word[i] = temp;
            Random ran = new Random ();

            String Val = word[ran.nextInt(word.length)];

            System.out.println(Val);

        }
    }
}
</code></pre>
