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
Can the interface be final?
What is main function purpose?
How do you use compareto method?
What is default constructors?
How do you declare an array that will hold more than 64KB of data?
Tell us something about set interface.
What’s the difference between callable and runnable?
how to create multithreaded program? Explain different ways of using thread? When a thread is created and started, what is its initial state? Or extending thread class or implementing runnable interface. Which is better? : Java thread
What is charat java?
Why is java architectural neutral?
How do you add an element to an arraylist in java?
Tell us something about different types of casting?
Highest level event class of the event-delegation model?
Can set contain duplicates?
What is character in data type?