提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
了解价值传递
/* from N o w J a v a . c o m - 时 代 Java */ public class ChangeParameters { public static void main(String[] args) { int number = 1; tryToChangeNumber(number); System.out.println(number); } public static void tryToChangeNumber(int i) { i = 2; } }