Welcome to Kodlogs Q&A, where you can ask programming questions and receive answers from other members of the community. For programmers, by programmers Kodlogs is an open community for anyone that does coding. We help you get answers to your toughest coding questions, share knowledge with your coworkers in private, and find your next IT dream job.
0 votes
exception in thread "awt-eventqueue-0" java.lang.nullpointerexception
in Java Programming by (2.5k points)

1 Answer

0 votes
The variable num is invalid, and until you relegate a non-invalid an incentive to it will stay invalid. Presently there are two conceivable fixes:

1) appoint a non-invalid an incentive to num in its constructor

2) check against invalid in paintComponent:



in the event that (num != invalid)



by (8.5k points)