You need to specifically run this class, find the class in the project explorer (left hand side of netbeans) right click on it and choose the run option.
The problem isn't a Java problem (as far as I can see), it's a problem with how to use Netbeans to run the Java code. So I'm moving the thread to the forum where IDEs are discussed.
Mohsen Salahshoor wrote:You need to specifically run this class, find the class in the project explorer (left hand side of netbeans) right click on it and choose the run option.
That should do the trick. Be sure that you provide full class name, ie. com.example.myproject.Main, not just the name class alone.