[Solved] NullPointerException object and arrays


The method is lack of a modifier static

It should be public static void main(String[] args) {.

Change your code of class SearchComparison as follows and you will get the right result.

public class SearchComparison {

public static void main(String[] args) {
    StopWatch watch = new StopWatch();
    ArrayUtilities utilities = new ArrayUtilities();
    watch.start();
    utilities.generateRandom(5);
    watch.stop();
}

}

The result of one run is as follows:

1569548985
215764588
880641847
874970313
446064254

1

solved NullPointerException object and arrays