What is difference between constructor and method?
Answers
Answered by
1
Answer:
There are a lot of difference . Constructor is used to initialise the value of object as soon as object is created but method is not doing this task.
Constructor has no return type but method has return type.
Constructor have same name as of class name but this is not case of method.
For Example
class A
{
A() //it is constructor
{
//body
}
public void X()
{
// this is method
}
}
Answered by
0
Answer:construtor has no return type while method has a return type.
A constructor has a same class name but a method may not have the same class name.
Explanation:
Similar questions