File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Exception in thread Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Exception in thread "main" java.lang.NullPointerException" Watch "Exception in thread "main" java.lang.NullPointerException" New topic

Exception in thread "main" java.lang.NullPointerException

albert kao
Ranch Hand

Joined: Feb 04, 2010
Posts: 252

$ javac
$ javac
$ java DFS

Exception in thread "main" java.lang.NullPointerException
at DFS.toplogicalSort(
at DFS.main(
Riaan Nel
Ranch Hand

Joined: Apr 23, 2009
Posts: 160

Albert, you forgot to ask a question.

Just out of curiosity, why are you only using positions 1 - 5 in your Vertex array? The first index in a Java array is 0.

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." - George Bernard Shaw
Nico Van Brandt
Ranch Hand

Joined: Mar 31, 2011
Posts: 66

A constructor does not have return type void in the signature.
It should be:

Oracle Java SE6 Certified Programmer
Oracle Java EE5 Certified Web Component Developer
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46320
Does the API description for this method help?
I agree. Here's the link:
subject: Exception in thread "main" java.lang.NullPointerException
It's not a secret anymore!