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

Can classes declared using the abstract keyword cab be instantiated?

557


What is difference between arraylist and list in java?

578


How do you write a good declaration?

489


What value is a variable of the string type automatically initialized?

609


What is singleton class in ruby?

558






What do you mean by composition in java?

563


How do you create immutable object in java?

535


What is collection sort in java?

551


What is the protected method modifier?

561


Is Constructor possible in abstract class in java ?

588


What is the primitive type byte?

579


How do you check if a character in a string is a digit or letter?

508


What is the r character?

585


Is it possible to define a method in java class but provide it’s implementation in the code of another language like c?

575


What are constants?

594