+ 1

Can any show me where is constructor in this program. The given information isn't clarifying the doubt please help me

https://code.sololearn.com/cS8w7GmPaCn3/?ref=app

20th Sep 2017, 6:42 PM
gaurav kumar
gaurav kumar - avatar
6 Respostas
+ 11
There is no constructor. The method is static, so the jvm can call it without needing an instance of the class.
20th Sep 2017, 6:45 PM
Tashi N
Tashi N - avatar
+ 9
There is no object necessary for a static method. The default constructor is called when you create an object using new, but didn't declare a constructor in your class. Then the default constructor creates an object and returns it. If you would write down the default constructor for My class it would look like this: public MyClass() {}
20th Sep 2017, 6:59 PM
Tashi N
Tashi N - avatar
+ 9
If you create an object of that class that contains your main method then the default constructor is called as well, as long as you don't declare a constructor.
20th Sep 2017, 7:01 PM
Tashi N
Tashi N - avatar
+ 2
our lecturer says, constructors is found in every program whether it may be create default. what is mean by default constructor
20th Sep 2017, 6:50 PM
gaurav kumar
gaurav kumar - avatar
+ 2
and thanks for answering me
20th Sep 2017, 6:51 PM
gaurav kumar
gaurav kumar - avatar
+ 2
kk thanks it really helpful
20th Sep 2017, 7:15 PM
gaurav kumar
gaurav kumar - avatar