Tuesday, 27 August 2013

Why java allows method that has class name and type void

Why java allows method that has class name and type void

Java allows to create method which has the name of the class and type void
( Like void constructor). Constructor has no type and it do the function
of the constructor. But is there any usage above mentioned kind of
methods. Can you give examples of those usages
Sample Code:
//my class
class MyClass{
//constructor
public MyClass(.....){
}
//What is the use of the below method
public void MyClass(....){
}
}

No comments:

Post a Comment