Command line to array

Hi,

How do i take a command line input and place it in an array?

This has been driving me nuts for two days.

please please please help :confused:

which prog language r u using to do this ?

Hi, im using Java.

Ive just figured out that commandline input is stored in the args .

Does anyone know a simple clean way to display the contents of the args???

for(String s1:args)
{
System.out.println(s1);
}

put it in ur main()

got it?

I only have the one? Im pretty sure im making a mess of it ?

What do you think? Ive been using Java for three days…any advice?

import java.util.Scanner;
public class AddStudent {

/**
 * @param args the command line arguments
 */
public static void main(String args[])

//for(String s1:args)
{
Scanner newStudent = new Scanner (System.in);

System.out.println("Please enter student name:"); //prompt for input
String studentName = newStudent.nextLine(); // read line of input
System.out.println(); //displays blank line
System.out.println( studentName);//displays student name
System.out.printf("has been successfully enrolled! \

");//states string
//System.out.println(s1);

}

public static void main(String args)
{
Scanner newStudent = new Scanner (System.in);
System.out.println(“enter first string”);
String s1=new String[10];
s1[0]=newStudent.next();
System.out.println("first string is : “+s1[0]+”
");
System.out.println(“enter second string”);
s1[1]=newStudent.next();
System.out.println("second string is : "+s1[1]);
}

thanks for that thats great!!

buuutt…

Rather than second string equals +s1

how do i get

system.out.println(s1 All array entries)