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

Started by
2 comments, last by Thoover 16 years, 4 months ago
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...
Advertisement
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.
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...
fixed my problem and finished the program again ill post the code in that link

This topic is closed to new replies.

Advertisement