Solved

NullPointerException

Posted on 1998-07-22
3
212 Views
Last Modified: 2010-05-18
I recently download a working applets and after running it without changing any codes, it give me an Java.Lang.NullPointerException error.

Anbody know why error is this and what causes it?
0
Comment
Question by:wizlor
  • 2
3 Comments
 
LVL 1

Accepted Solution

by:
dryang earned 100 total points
ID: 1227791
This is something from the JDK 1.1.6 documentation.

public class NullPointerException
extends RuntimeException

Thrown when an application attempts to use null in a case where an object is required. These
include:

    Calling the instance method of a null object.
    Accessing or modifying the field of a null object.
    Taking the length of null as if it were an array.
    Accessing or modifying the slots of null as if it were an array.
    Throwing null as if it were a Throwable value.

Applications should throw instances of this class to indicate other illegal uses of the null object.

This can be cause by a few things
1) Bad programming practices, where the programmer does not take care with
      - arry lengths
      - vector sizes
      - accesing empty Vectors. eg using the elementAt mehtod.( I did theis before :) )

2) Exception cases
     - plain bad luck when your data length values get corrupted and your pointers point to nowhere(did they mention that java had no pointers?)...

do go over the codes and see if you can spot the bug (usually in the looping sections, for and while loops)

regards
0
 

Author Comment

by:wizlor
ID: 1227792
Thx for your help.
0
 
LVL 1

Expert Comment

by:dryang
ID: 1227793
hi wizlor,
you're welcome
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question