Saturday, 15th October 2011
Follow WikiJava on twitter now. @Wikijava

LoopTest.java

From WikiJava

Jump to: navigation, search


This Java application can accept any number of arguments from the command line. Command line arguments allow the user to affect the operation of an application.

Contents

the article

This is a simple application that accepts arguments passed from the command line by a user, and prints them out to the screen.

Example, The user would enter the folowing comand at the comand line; C:\ java testingloops.LoopTest Tusker Pilsner Castle

command line arguments

package org.wikijava.testingloops;
 
/**
 * @author Alex Mutuku Mbolonzi 
 * @version 07/06/08
 */
 
public class LoopTest {
 
    public static void main(String args[]){
 
//loop iterates through the arguments entered by the user and print's to screen.
        for (String i: args){ 
 
            System.out.println(i);
 
        }
    }
}

Comments from the users

To be notified via mail on the updates of this discussion you can login and click on watch at the top of the page

simple and effective

thanks for sharing:)

--DonGiulio 08:49, 17 September 2008 (PDT)


Comments on wikijava are disabled now, cause excessive spam.