0

i am new in java can any one please tell me the main use of constructor
if we can use method
in what cases its necessary to use constuctor

3
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by jaka.ramdani
0

Study the information found in the "Read Me: Starting Java" thread that is stickied at the top of this forum.

0

i am new in java can any one please tell me the main use of constructor
if we can use method
in what cases its necessary to use constuctor

just give it a simple though, there is Object in Java, and the Object has Method which is its accessor. SO you cannot access the Object accessor before the Object itself is created (initialized) isn't it, except the method is static (which don't necessarily the Object to be instantiated), and one way to create/instantiate an Object is to call it constructor, jvm will give empty constructor for your classess even if you don't provide one.

hope it will give you some light.

regards,

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.