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

Answer Posted / bindhu

In Java, initialization of every object possible
by providing a constructor. If a class has a constructor,
Java automatically calls that constructor when an object is
created. So initialization is guaranteed.

If we don't define a constructor for a class, a default
parameterless constructor is automatically created by the
compiler.

Is This Answer Correct ?    6 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are strings in physics?

766


What is the difference between call by reference and call by pointer?

721


What is your platform’s default character encoding?

785


Is java good for beginners?

755


How many ways can you break a singleton class in java?

713


What is the full form of jpeg?

729


What are advantages of exception handling in java?

792


What is annotation in java?

782


When do I need to use reflection feature in java?

820


Can we inherit inner class?

733


What are variable names?

716


What is the default value of local and global variables?

836


What is the purpose of object oriented programming?

714


Why Do I Get A "permission Denied" Error After Downloading The .jnlp Java Launcher For The Vkvm?

857


What is qualitative variable?

728