Differentiate constructor and a method and how are it be
used?

Answer Posted / teju

constructor: It is one special member function.it has name same like class .it does not have any return type.it gets executed when we create an object of class and invokes implicitly. constructor is used to initialize the variables ,start the thread

method:
it gets executed explicitly when object is created . it has return type .
method is used to invoke the task or block of code

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Are arrays passed by reference in java?

481


What is vector?

582


Explain the difference between map and flatmap stream operation?

812


Why are data types important?

531


Why is java architectural neutral?

610






What is internal variable?

534


What is unmodifiable collection in java?

505


What are inbuilt functions?

563


Explain the overview of UDP messaging.

731


Is void a wrapper class?

525


What is difference between c++ and java ?

665


What is string pooling concept?

548


Explain illegalmonitorstateexception and when it will be thrown?

613


What are wrapper classes in java?

592


Explain how to convert any java object into byte array.

543