Sign in to follow this  

[java] all strings and ints going back to null help please

This topic is 3670 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

ok my problem here is that the answ keeps going back to null and thats all that i thought at first till i put System.oyt.println check points everywhere in my code and noticed everything did, all i need fixed really is answ so i can answer the question how i did it this time worked in all programs in the past and i cant figure this one out any help appreciated... my code is here: the src is cut mildly here...

Share this post


Link to post
Share on other sites
Not quite sure why you try and hide the fact that your class is called millonario; but anyway...

I suspect the problem might be that you're instantiating two instances of millonario; one called game, and the other is added to the JFrame in one of the constructors.

So for example; if you were to invoke game.score(), etc... any changes wouldn't be reflected in the presentation.

Other than that try setting breakpoints everywhere you assign a value to 'answ', that way you can check what/when it gets modified.

Share this post


Link to post
Share on other sites
i think i found the problem, the values are only set with the things called in public millonario() but not in anything involved with public millonario(String arg[])

the first one includes run and paint
the second one includes every thing else

any idea why it wouldnt share values with all the voids in the class?

the reason i have 2 public millonario is becouse if i only have 1 i hit an inf. loop and if i have more than one class i couldnt share vales of strings and ints which for some reason i still cannot do...

Share this post


Link to post
Share on other sites

This topic is 3670 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this