What would be behaviour if the constructor has a return type
What would be behaviour if the constructor has a return type?
a) Compilation error
b) Runtime error
c) Compilation and runs successfully
d) Only String return type is allowed
Answer: a
Explanation: The constructor cannot have a return type. It should create and return new object. Hence it would give compilation error.
支付宝转账赞助
支付宝扫一扫赞助
微信转账赞助
微信扫一扫赞助