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...


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

Answers were Sorted based on User's Feedback



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

Answer / janet

Constructor will be automatically invoked when an object is
created whereas method has to be called explicitly.

Is This Answer Correct ?    11 Yes 1 No

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

Answer / kabita

constructor & methods are both member functions of a class.
when an object is created the constructor is invoked
automatically,bt we have to call the methods explicitly
through objectname.
methods have returntype ,bt constructors haven't.
constructors must have same name as class name bt methods
have not.
constructors are used for initialization of
objects,variables.

Is This Answer Correct ?    9 Yes 0 No

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

Answer / pranab dutta

A constructor is a member function of a class that is used
to create objects of that class where as a method is an
ordinary member function of a class.
Constructor has the same name as the class itself and
Member has its own name.
A Constructor has no return type, and is invoked using the
new operator.. Whereas a Member has a return type (which
may be void), and is invoked using the dot operator.

Is This Answer Correct ?    8 Yes 1 No

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

Answer / vishwanath

mainly there are
i.constructor name is same as the class name whereas method name doesn't.
ii.constructor is implicitly called when an object is created.....but the method is explicitly called by using object.
iii.constructor has no return type hence it doesn't return anything.....but method has return type.
iv.constructor is used to create and initialize data members.....where as method is created to code the specific task.

Is This Answer Correct ?    4 Yes 0 No

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

Answer / arunji,shc

constructor it should be same name of class but method name
is userdefined.
when the object created constructor call automatically but
method through the object have to call.

Is This Answer Correct ?    1 Yes 0 No

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

Answer / devarathnam c,kotagudibanda(po

Hi...
Constructor(): It is also a method but it doesnot allow
return type even void also.It will call automatically
whenever an object is created of a appropriate class.
But class name and constructor should be the same.d
Method():U have to call explicitly .

Is This Answer Correct ?    1 Yes 0 No

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

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

More Core Java Interview Questions

Hi Friends, I am new to java. Can u explain about thread concept.How i know one thread is locked, and how can i force or acquire another thread for lock . Finally how to know thread is released from lock. Explain types of lock(like method level and block level) in thread.

1 Answers  


I want to know the host name and provider name for tcs web mail

5 Answers   RSG, TCS,


What is the reason that multiple inheritance is not possible in java??

1 Answers  


Can we increase size of array?

0 Answers  


What are concepts of OOPS and how are they implemented in Java?

2 Answers   KPIT,


If a method is declared as protected, where may the method be accessed?

0 Answers  


explain oops concepts with examples?

29 Answers   AbhiBus, Beeline, DELL, HCL, Satyam, TCS, VLS, Wipro,


How can constructor chaining be done using this keyword?

1 Answers  


How does marker interface provides functionality to the implemented class ? or How dose maker interface gets the functionalities as serialization or cloning.

4 Answers   Cap Gemini,


What is output buffer?

0 Answers  


How do you read and print a string in java?

0 Answers  


Why java doesn’t support multiple inheritances?

0 Answers  


Categories