小编CTM*_*CTM的帖子

有没有办法获取传递给方法调用的值?

我想知道当我将值传递给方法调用时。有没有办法直接从方法调用中获取值?

int playerPosition = calculateHighScorePosition(1500); //<-- Is there a way to grab this passed value?
        displayHighScorePosition("Perseus", playerPosition, 1500);//<-- Instead of hardcoding it in?
Run Code Online (Sandbox Code Playgroud)

这是我想知道的完整代码:

package com.company;

import org.w3c.dom.ls.LSOutput;

public class Main {

    public static void main(String[] args) {

        /*boolean gameOver = true;
        int score = 800;
        int levelCompleted = 5;
        int bonus = 100;
        int highScore = calcScore(gameOver, score, levelCompleted, bonus);
        System.out.println("Your final score was " + highScore);
        score = 10000;
        levelCompleted = 8;
        bonus = 200;
        highScore = calcScore(gameOver, …
Run Code Online (Sandbox Code Playgroud)

java methods

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

标签 统计

java ×1

methods ×1