Differentiate constructor and a method and how are it be
used?
Answer Posted / 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 View All Answers
How many threads can I run java?
What is the relationship difference the canvas class and the graphics class?
What do you understand by soft reference?
Define how does a try statement determine which catch clause should be used to handle an exception?
What is string pooling concept?
Is linkedlist thread safe in java?
Differentiate jar and war files?
What are the different types of java?
What are the access modifiers available in java?
Is special character in java?
What is port number in java?
Will the compiler creates a default constructor if I have a parameterized constructor in the class?
What are the major advantages of internal iteration over external iteration?
Does constructor return any value?
What are java annotations?