why constructor dont have returns type?

Answer Posted / sankar r k

The function of the constructor is to assign values to the
instance variable when the object is created for the first
time.The name of the constructor and the class name will be
same.

Is This Answer Correct ?    0 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do I know if java is installed?

519


what is mutual exclusion? : Java thread

554


Can we override the private methods?

523


Explain the use of volatile field modifier?

633


What is a “stateless” protocol ?

555






What type of variable is gender?

548


What is the default size of load factor in hashing based collection?

563


What does @param args mean in java?

552


What is a arraylist in java?

560


What is the use of flag?

583


Can we override private method?

556


23. Storage space in java is of the form Stack Queue Heap List 24. What is java code embedded in a web page known as Applets Servlets scriptlets snippets 25. Which of the following attributes are compulsory with an tag?. code,height & width. 26. What does 'CODEBASE' in an applet tag specify?. Files absolute path.

2056


Why packages are used?

548


When will you define a method as static?

557


What makes a function well defined?

519