Java – Method Parameter confusion

Usually, time methods require more than 3 parameters of the same type, such as

void mymethod (String param1,String param2,String param3)

Then the client can easily confuse parameter commands, such as reversing Param1 and param2:

mymethod (param2,param1,param3);

... this may be why spending a lot of time debugging should be a small thing Any tips on how to avoid this error (except unit testing)?

Solution

You are searching for: named parameter idiom in Java

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>