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
What are strings in physics?
What is the difference between call by reference and call by pointer?
What is your platform’s default character encoding?
Is java good for beginners?
How many ways can you break a singleton class in java?
What is the full form of jpeg?
What are advantages of exception handling in java?
What is annotation in java?
When do I need to use reflection feature in java?
Can we inherit inner class?
What are variable names?
What is the default value of local and global variables?
What is the purpose of object oriented programming?
Why Do I Get A "permission Denied" Error After Downloading The .jnlp Java Launcher For The Vkvm?
What is qualitative variable?