Vasserman
Vasserman

Reputation: 71

why java don't have default value for arguments in method call

for example with C++ I can write

void func(int a=1,int b=2){...}

using Java I have to create several methods

Upvotes: 4

Views: 1928

Answers (1)

Andrew Hare
Andrew Hare

Reputation: 351456

It wasn't a feature that the creators of Java thought was important enough to include. Remember that Java was partially created as a reaction against the complexities of C++.

Upvotes: 6

Related Questions