Can we write constructor in main method?

Yes generally it is preferable to design another class which has all the programming logic and just instantiate this class in the main class i.e. the one with main() method in it.

Sizin İçin Seçtik  What is a class parameter in Java?

Leave a Reply

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