Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

#Actualj-locke

Posted 11 August 2012 - 12:32 PM

What is this version of the code doing for you?

For me, it didn't compile right away. The line Ball ball = new Ball(); is trying to call a method that doesn't exist (there is no empty constructor for the Ball class).

When I changed that line so it was calling the real constructor, I get a stack overflow error (Exception in thread "AWT-EventQueue-1" java.lang.StackOverflowError) because when I call the constructor once, it recursively calls the constructor again and again until I'm out of available stack memory.

So, I wanted to see what kind of things your'e experiencing before we overhaul this and try to adjust the mindset of this approach.

edit: restating the reason for StackOverflowError

#2j-locke

Posted 11 August 2012 - 12:23 PM

What is this version of the code doing for you?

For me, it didn't compile right away. The line Ball ball = new Ball(); is trying to call a method that doesn't exist (there is no empty constructor for the Ball class).
When I changed that line so it was calling the real constructor, I get a stack overflow error (Exception in thread "AWT-EventQueue-1" java.lang.StackOverflowError) because I'm now trying to create an array and 4 ball objects every time the applet tries to paint (which is well above 100 times per second).

So, I wanted to see what kind of things your'e experiencing before we overhaul this and try to adjust the mindset of this approach.

#1j-locke

Posted 11 August 2012 - 12:20 PM

What is this version of the code doing for you?

For me, it didn't compile right away. The line Ball ball = new Ball(); is trying to call a method that doesn't exist (there is no empty constructor for the Ball class).
When I changed that line so it was calling the real constructor, I get a stack overflow error (Exception in thread "AWT-EventQueue-1" java.lang.StackOverflowError) because I'm now trying to create an array and 4 ball objects every time the applet tries to paint (which is 100+ times per second).

So, I wanted to see what kind of things your'e experiencing before we overhaul this and try to adjust the mindset of this approach.

PARTNERS