I am having a problem with arrays.... for this assignment i can not use Arraylist... I only be able to use array of string. 
here is my problem. I am asking the user to enter words with in 1 minute ... when the time is up ..i need to print out what ever the user entered... 
    1, I am going to set up BufferedReader to accept input
    2, then will try to split using split method
    3, THIS IS THE PROBLEM I HAVE... I DON'T KNOW HOW STORE IT IN ARRAY.
   can I creat by saying  String [] arrayList = new String [200]
    I am just assuming the user wont put more than 200 words in 1 min... How can i be able to store all the input ? how can i be able to print out in order that has been entered? Just need littile help storing the list in array...thank you.

Well, if you're using the String.split() method, it handles creating the array for you. Maybe explain how you are splitting things up, like do you have to handle each line individually? Or is it all going to be one line? Etc.

If you have to handle the split yourself, then you could created a new array and copy elements over if it happened to become to big. You need to post some more details...

6) and 7) make sense. You could use String[1000] also. The extra unused slots in the array take up very little room.
You will need an int value as an index that points to the next empty slot in the array. As you add Strings to the array, increment the index so it points to the next empty slot.

Do you know how to assign a value to an element of an array using an index?
theArray[theIndex] = theValue;

Well I know how to split a sentence and count the number of words like this by creating a method

    public static int  getWords(String incoming)
    {
        String [] myString = incoming.split(" ");
        return myString.length;
    }




     but when i try to use the same idea to split the input like...
     /__________________________________________
        System.out.println("enter your name");
        // used scanner this time 
        Scanner input = new Scanner(System.in);
        String read = input.nextLine();
         String [] myString = read.split(" ");
         System.out.print(myString);

         It print out this  [Ljava.lang.String;@5265a77f ..

is this possible?
String[] myArray = new String[100];
System.out.println("enter your names");
// used scanner this time
Scanner input = new Scanner(System.in);
String read = input.nextLine();
myArray.Add(read);

if i use split method? how can incorporate with it? am really lost on this

System.out.print(myString);
You are trying to print an array. Split will create the array in one go, but you need to do some work to print it. You need to use a loop.

An easy way to print the contents of an array is to use the Arrays class's toString() method to format the array for printing. For example:

  System.out.println("an ID here " + java.util.Arrays.toString(theArrayNameHere));
Comments
Oh, boy! You telling that tyo a beginner without explaininghow it works. tsk tsk!
This article has been dead for over six months. Start a new discussion instead.