Sometimes when I run a program that I am writing in NetBeans, it runs old code or something. It want do what I just put in. Instead it will run past code. I will get a bug in the program I am writing and when I fix it. It still acts like the bug is there. When I make a new project and run my code in that project it works. Anyone know why? Am I doing something wrong?

Possible is that you are using only Build Main Project(F11), where you should use Clean and Build Main Project(Shift+F11)

commented: helped +1

I hardly ever do anything but build. Although it does it sometimes even when I do clean and build.

whenever you run a program...use SHIFT F6 to run the current code...because usually when we run a program it has few old codes saved and netbeans execute the old programs for us...but try using SHIFT F6 to run the current program...