Constructors cannot have return type and that is the basic difference between a method and a constructor.
Here compiler is considering void MyClass() as a method and hence a default contructor with no arguments is provided by the compiler for your class.
And when you are passing argument in your new MyClass(i), no match is found for this constructor.
Solution: Do not give any return type keep it "public MyClass( int i )" this will work for you...