java create constructor with parameters code example Example: java constructor class MyClass { public MyClass () { //constructor code } }