wood burning stoves
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

Win a copy of Building Microservices this week in the Design forum!
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 Vertex.java
$ javac DFS.java
$ java DFS

Exception in thread "main" java.lang.NullPointerException
at DFS.toplogicalSort(DFS.java:71)
at DFS.main(DFS.java:80)
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: 44031
Does the API description for this method help?
Have you checked out Aspose?
subject: Exception in thread "main" java.lang.NullPointerException
jQuery in Action, 3rd edition