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

Answer Posted / ravikiran

constructor is used to initialize the variables during the
creation of instances.
If there is no constuctor no object will be gets created.

Is This Answer Correct ?    0 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is array dynamic in java?

677


What is the difference between a method and a procedure?

755


What is a values collection view ?

867


What is difference between equals and hashcode method?

777


What is the difference between this() and super() in java?

770


What is meant by method?

789


Difference between string s= new string (); and string s = "abv";?

982


How variables are declared?

732


What is considered an anti pattern?

708


Can we use switch statement with strings?

800


How do you sort a set in java?

719


What is a function easy definition?

734


How are destructors defined in java?

795


How an object is serialized in java?

750


Is there any limitation of using inheritance?

803