When I create this new class Quake and try to write some code in it ,it displays the following message,

and when I try to run it Android Studio automatically delete the class Quake.

Can someone explain me why is this happening and how to resolve it ?
You're in Packages view and putting all your files in the wrong folder. Switch to Project view (left hand, top side toggle). Under app, you should see a folder called src -> main -> java -> com.example.prateek. That's where all your class files should properly be to avoid autodeletion.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With