• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Threads

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic