小编Pey*_*can的帖子

Java方法参数是否被突变?

由于某种原因,我的方法perfectShuffle(int [] values)正在改变传递给它的参数,请告诉我为什么这是......这对我没有意义,因为Java是一种"通过价值传递"编程语言.

public class Shuffler {

    /**
     * The number of consecutive shuffle steps to be performed in each call to
     * each sorting procedure.
     */
    private static final int SHUFFLE_COUNT = 4;

    /**
     * The number of values to shuffle.
     */
    private static final int VALUE_COUNT = 5;

    /**
     * Tests shuffling methods.
     * 
     * @param args
     *            is not used.
     */
    public static void main(String[] args) {
        System.out.println("Results of " + SHUFFLE_COUNT
                + " consecutive perfect shuffles:"); …
Run Code Online (Sandbox Code Playgroud)

java syntax

0
推荐指数
1
解决办法
350
查看次数

标签 统计

java ×1

syntax ×1