What is the difference between method and constructor ?

Answer Posted / malli

constructor: 1)It is special type of member function.
2)it should not support any return type.
3)it should not support any static and final
4)mainly we can use for object initialization
method:
1)it is normal member function
2)it support return type and static final.
3)methods for to develop business logic we can use.

Is This Answer Correct ?    10 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to implement a multithreaded applet?

2208


Can we create an object of private class?

552


Is singleton class thread safe?

544


Can static methods be inherited?

537


What is synchronization and why is it important in java programming?

475






Explain the available thread states in a high-level?

537


Why are the objects immutable in java?

554


what do you mean by stream pipelining in java 8? Explain

544


How can we use primitive data types as objects?

564


What is default size of arraylist in java?

565


What is a 16 bit word?

571


In java how do we copy objects?

561


What is Classloader in Java?

642


What is the purpose of using the java bean?

578


What are the steps involved to write rmi based programs?

575