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 Beginning Java and the fly likes cannot understand the exception in my code,please help 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 » Beginning Java
Bookmark "cannot understand the exception in my code,please help" Watch "cannot understand the exception in my code,please help" New topic
Author

cannot understand the exception in my code,please help

liu hao
Greenhorn

Joined: Oct 02, 2009
Posts: 9
the null Point exception occurs at the at but I think my constructor has initialized the point2D objects.
please point out my mistake. tons of thanks.

Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

liu hao wrote:the null Point exception occurs at the at


in which line you invoking this ? instead please tell the line number
D. Ogranos
Ranch Hand

Joined: Feb 02, 2009
Posts: 214
You are never initialising the Point2D objects in your MyRectangle class. In your constructor (or in the declaration) you need to create new objects for these. For example, your method setBottomLeftPoint attempts to do something like null.setLocation(...).

OR, simply assign the Point2D objects that you are passing to your constructor to your instance variables.
liu hao
Greenhorn

Joined: Oct 02, 2009
Posts: 9
a lot of thanks.It seems I didn't understand that staff thoroughly.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37950
    
  22
And welcome to JavaRanch
 
jQuery in Action, 2nd edition
 
subject: cannot understand the exception in my code,please help
 
Similar Threads
finding closest point
I'm fazed by a nullpointererror I can't get rid of
Once through or twice through?
Help on zooming in on an image
pls suggest me a good style of programming