首页 > 代码库 > how to implement C# ref in Java
how to implement C# ref in Java
In C# we have ref and out, while in Java we don‘t.
To do something similar to ref, there are normally 4 ways.
Check this out: http://stackoverflow.com/questions/5614562/how-to-do-the-equivalent-of-pass-by-reference-for-primitives-in-java
Choice 1: make a public member variable in a class
Choice 2: return the value instead of pass by reference
Choice 3: make it a class or static variable
Choice 4: Create a single element array of type int and pass that
how to implement C# ref in Java
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。