Can you create an object of a class within the same class in Java?

In java you cannot create a method outside of a class . All methods must be encapsulated within a class. Therefore the main method as an entry point to the program must be within a class. When you run this program the main method will be run once and will execute the code inside it.

Sizin İçin Seçtik  Hangi marka araç daha iyi?

Leave a Reply

Your email address will not be published. Required fields are marked *