• Post Reply Bookmark Topic Watch Topic
  • New Topic

Threads

 
Chris Roberts
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24213
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!