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  Why do we use Java constructor?

Leave a Reply

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