Why do we use constructors in Java?

Mia Wright | 2023-05-05 14:09:59 | page views:1088
I'll answer
Earn 20 gold coins for an accepted answer.20 Earn 20 gold coins for an accepted answer.
40more

Noah Davis

Works at the International Seabed Authority, Lives in Kingston, Jamaica.
The purpose of constructor is to initialize the object of a class while the purpose of a method is to perform a task by executing java code. Constructors cannot be abstract, final, static and synchronised while methods can be. Constructors do not have return types while methods do.
2023-05-15 14:09:59

Zoe Campbell

QuesHub.com delivers expert answers and knowledge to you.
The purpose of constructor is to initialize the object of a class while the purpose of a method is to perform a task by executing java code. Constructors cannot be abstract, final, static and synchronised while methods can be. Constructors do not have return types while methods do.
ask:3,asku:1,askr:137,askz:21,askd:152,RedisW:0askR:3,askD:0 mz:hit,askU:0,askT:0askA:4