What is true about constructor

date:2024-06-05 12:24:49 author:admin browse: View comments Add Collection

What is true about constructor

What is true about constructor?

a) It can contain return type

b) It can take any number of parameters

c) It can have any non access modifiers

d) Constructor cannot throw an exception

Answer: b

Explanation: Constructor returns a new object with variables defined as in the class. Instance variables are newly created and only one copy of static variables are created.
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

支付宝转账赞助

支付宝扫一扫赞助

微信转账赞助

微信扫一扫赞助