?
Solved

NullPointerException

Posted on 1998-07-22
3
Medium Priority
?
217 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 300 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
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 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 …
Suggested Courses
Course of the Month13 days, 13 hours left to enroll

800 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