Differentiate constructor and a method and how are it be
used?
Answer Posted / 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 |
Post New Answer View All Answers
Why scanner is used in java?
What is thread start?
How to perform quicksort in java?
I want to store more than 10 objects in a remote server? Which methodology will follow?
What are the 6 mandatory procedures for iso 9001?
Mention some features of java?
Write a program to search a number in the given list of numbers.
What is Session reduplication and how its done?
Can extern variables be initialized?
What is the difference between yielding and sleeping?
Can we convert list to set in java?
What is a string token?
What is the purpose of garbage collection in java?
What is object english?
Which one will take more memory: an int or integer?