集册 Java实例教程 将参数传递给方法

将参数传递给方法

欢马劈雪     最近更新时间:2020-01-02 10:19:05

449
提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
将参数传递给方法

public class Main {
/*from 时   代     Java  公  众  号 - nowjava.com*/

    void toUpperCase(String[] text) {

        for (int i = 0; i < text.length; i++) {

            text[i] = text[i].toUpperCase();

        }

    }


    public static void main(String[] arguments) {

        Main passer = new Main();

        passer.toUpperCase(arguments);

        for (int i = 0; i < arguments.length; i++) {

            System.out.print(arguments[i] + " ");

        }

        System.out.println();

    }

}
/* from 
时 代 J a v a 公 众 号*/