Passing Arguments to Methods - Java Object Oriented Design

Java examples for Object Oriented Design:Method Parameter

Description

Passing Arguments to Methods

Demo Code

public class Main {

    void toUpperCase(String[] text) {
        for (int i = 0; i < text.length; i++) {
            text[i] = text[i].toUpperCase();
        }//from   w  w  w.  j av a2s .c o  m
    }

    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();
    }
}

Related Tutorials