Solved

NullPointerException

Posted on 1998-07-22
3
215 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

690 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