• Post Reply Bookmark Topic Watch Topic
  • New Topic

Objects and Classes  RSS feed

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm getting an error - Null Pointer exception.

My simulator class




My Portfolio Class



The error I'm getting

 
Ranch Hand
Posts: 250
1
Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chances are your arrayStock variable is a null pointer (i.e. doesn't point to an object). Since you didn't post all of your code or at least where you attempt to initialize your array, we can't really help you further.
 
Bruce Banner
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I put all of my code
 
Joel Christophel
Ranch Hand
Posts: 250
1
Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bruce Banner wrote:I put all of my code

What about the Stock class? Where's that?
 
Bartender
Posts: 612
7
Mac OS X Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Two things,

1) do not go back and change your original post, as it makes further posts seem odd.

2) i do not see where you call initialize, so see Joel's post above - you never initialized the array.

3) and do try to supply better subject lines that are more descriptive of your issue.

hope this helps,

-steve

 
Bruce Banner
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My Stock Class



 
Joel Christophel
Ranch Hand
Posts: 250
1
Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The error goes away if you call the initaltize() method on your Portfolio object before you try to use it. Also, you spelled initialize wrong
 
Bruce Banner
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What, I hade a brain fart.
 
Bruce Banner
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
*had
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!