why the constructor should be used in class,if there is no
constructor what will happen?

Answer Posted / yamini

Constructor is used initialize certian paramameters to each
object on their creation.We can also overload
constructors.So we can initialize objects with diff params.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain differences between collection api and stream api?

612


What is the reflection?

563


Is an object null?

561


What does percent mean in java?

590


What are the types of methods in java?

580






What will be the output of round(3.7) and ceil(3.7)?

683


Is jdk required on each machine to run a java program?

754


Can we call a non-static method from inside a static method?

561


How do you compare arrays in java?

505


What is a jit compiler?

640


What is square root in java?

588


What is static method with example?

618


What is the role of garbage collector in java?

495


What is the difference between heap and stack memory?

548


What is natural ordering in java?

530