In C# it's possible to write:
MyClass obj = new MyClass()
{
field1 = "hello",
field2 = "world",
field3 = new MyOtherClass()
{
etc....
}
}
I can see that array initialization can be done in a similar way but can something similar to the above be done in Java too, and if so, what's the syntax?