This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

cannot understand the exception in my code,please help  RSS feed

 
liu hao
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 214
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
a lot of thanks.It seems I didn't understand that staff thoroughly.
 
Campbell Ritchie
Sheriff
Posts: 55283
156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And welcome to JavaRanch
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!