I was trying to run three threads at the same time. The threads are called Bubble Sort, Selection Sort, and Insertion Sort. I have created at vector that is suppossed to create random numbers(it does) and a DisplayPanel that is supposed to display the sorted threads in my created frame. I kept getting an error at run time saying " Exception in thread "Thread-2" java.lang.NullPointerException at Sort$BubbleSort.run(sort.java:193). I don't know whats going on can someone help. Here is my code only for my display panel and BubbleSort() method for reference.
author and iconoclast
Well, the only thing in BubbleSort.run() that could be null would be the array variable "a". It looks like you grab that from the enclosing class -- I don't see where the array is declared or initialized, though. So look at your code, and make sure that "a" is getting set to non-null at some point before you start the BubbleSort thread.