This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Java in General and the fly likes NullPointerException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "NullPointerException" Watch "NullPointerException" New topic
Author

NullPointerException

Vishnu Prakash
Ranch Hand

Joined: Nov 15, 2004
Posts: 1026
Why am I getting a NullPointerException in this example



Servlet Spec 2.4/ Jsp Spec 2.0/ JSTL Spec 1.1 - JSTL Tag Documentation
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Originally posted by vishnu prakash:
Why am I getting a NullPointerException in this example...

Because you set av to null, then tried to call an instance method without an instance...

If you need to call video() without having a specific instance of AudioVideo, then video() should be static.


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Vishnu Prakash
Ranch Hand

Joined: Nov 15, 2004
Posts: 1026
Thanks for the explanation.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: NullPointerException
 
Similar Threads
q from jiris.com
Bad Class Error
Understanding Exception handling
Calling method from another class
Method overriding