null pointer exception

Posted on 2004-11-11
Last Modified: 2010-03-31
I'm not sure what i'm doing wrong i create a class in called point that looks like:
public final class point
      private int x;
      private int y;

Then in another class called i have my main method that looks like:
public class Distance
      public static void main(String[] args)
            int size = 2048;
            point[] Parray = new point[size];
at the line Parray[0].x=4; i keep getting the following error:
Exception in thread "main" java.lang.NullPointerException
I'm not sure what i'm doing wrong
Question by:vonster
    LVL 13

    Accepted Solution

    Parray[0] = new point();
    LVL 13

    Expert Comment

    also u need a constractor to ur point class

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
    Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
    Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
    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:

    794 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

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now