Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


What is the difference between method and constructor ?

Answers were Sorted based on User's Feedback



What is the difference between method and constructor ?..

Answer / dineshkumar

A method is a set of code that will perform a specific task. It must have a name which is accurate to the task it performs, must have a return type(if nothing must be prefixed with void), an optional access specifier, may have parameters/arguments. It is called whenever it is needed.A method can be overloaded and overridden.

A constructor is a special block of code which has the same name as its class name with no return type. It is executed only once for an instance of the class. It is, logically, used for initializing the object(its parameters). A constructor cannot be overridden but can be overloaded by differing no.of arguments.

Is This Answer Correct ?    12 Yes 3 No

What is the difference between method and constructor ?..

Answer / 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

What is the difference between method and constructor ?..

Answer / sukale shobha balshiram

A Method is set of data that perform specific task. it has
return type.but consturtor does not have return
type.consturtor name smae as class name.

Is This Answer Correct ?    4 Yes 3 No

Post New Answer

More Core Java Interview Questions

Explain about data types?

0 Answers  


What does sprintf return?

0 Answers  


what is mean by method signature?

5 Answers   Satyam,


What is the difference between array and array list in java?

0 Answers  


Explain parallel processing in java8?

0 Answers  


What is variable in java?

0 Answers  


Explain the pointers in Java?

0 Answers   Aspire,


What does 0 mean in boolean?

0 Answers  


Can a class be private in java?

0 Answers  


What is the purpose of default constructor?

0 Answers  


What is the statements?

0 Answers  


What is return data type?

0 Answers  


Categories