This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell 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


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: 39079
    
  23
And welcome to JavaRanch
 
Don't get me started about those stupid light bulbs.
 
subject: cannot understand the exception in my code,please help