why constructor dont have returns type?

Answer Posted / venkatesh

Constructor donot return any data.it is mainly used for
initialization i.e one time activity like database
connectiviy, constructors are automatically invoked when
created objects created.

Is This Answer Correct ?    32 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the purpose of file class?

545


How do you calculate roots in java?

523


Can substring create new object?

556


Which collection is ordered in java?

531


Is it possible to use Semaphore/ Mutex in an Interrupt Handler?

532






What is binary tree in java?

530


How to connect to a remote database using Applet?

2040


Is set sorted in java?

514


What does nullpointerexception mean?

617


Explain all java features with real time examples

1204


Write a function to find out longest palindrome in a given string?

590


Which is the best approach for creating thread ?

721


how to create multithreaded program? Explain different ways of using thread? When a thread is created and started, what is its initial state? : Java thread

530


What is ternary operator in java?

593


Is singleton a bad practice?

575