The reason behind this is that meanwhile creating your own class, you had also accepted to create a default class as prescribed by your IDE and after writing your code in your own class, you are getting such an error. In order to eliminate this, go to the PROJECT folder → src
→ Default package. Keep only one class (in which you had written code) and delete others.
After that, run your program and it will definitely run without any error.