Home  >  Forum  >  Core Java
Post New Query

constructor with same argument is possible in java?


joined on
September 16,2014
Asked on June 04,2015
constructor with same agrument is possible in java? 
joined on
March 10,2015
Replied on June 04,2015

no, not possible in same order but possible in different order.


Not Possible way--

public class MyClass{
public MyClass(int size, string name){}
public MyClass(int size, string name){}
}


Possible way --

public class MyClass{
public MyClass(int size, string name){}
public MyClass(string name, int size){}
}
joined on
March 15,2013
Replied on June 04,2015

A constructor must have the same name as the class and must not have a return type.

Write Answer









Copyright ©2017 concretepage.com, all rights reserved |Privacy Policy | Contact Us