[Solved] Calling methods in java and C# [closed]


Can we call a method in java or C# like this without parameters but
separated with commas:

No you can’t. According to the method’s signature there are expected 3 integer literals. That being said, you can’t call it this way.

Regarding the C#, you could define a, b and c as optional int, like below:

public void Method(int a = 0, int b = 3, int c = 2)
{
    // ...
}

and call the method as below:

object.Method()

or as:

object.Method(1);

etc. Regarding this feature, please have a look here.

solved Calling methods in java and C# [closed]