Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Cannot find symbol - method nextInt(int) Error

$
0
0
So I have a problem with my code, and I can't figure it out for the life of me.
Here's the code...
    public class Numbers
    {
        int[] numbers = new int[25];
        {
            for(int i=0;i<25;i++)
            numbers[i] = i+1;
            int size = 25;
            Numbers rnd = new Numbers();
            for(int row=0;row<4;row++)
            {
                for(int col=0;col<5;col++)
                {
                    int r = rnd.nextInt(size);
                    System.out.print(numbers[r]+"\t");
                    numbers[r]=numbers[size-1];
                    size--;
                }
                System.out.println("");
            }
        }
    }


The error I get is "Cannot find symbol - method nextInt(int)" The error is on line 13.
Any help would be great! Thanks.

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>