I have a file that is tab separated. i read it in as an arraylist<string> how can i print out only the second section of the file?

That depends what "second section" means. If you can't be more specific than that, you have little chance of getting a program to do something with it.

the file is tab separated into three sections.

section1 section2 section3

i only want to read section2

array is an arraylist<string>

for (int i = 0; i<array.size(); i++)
        {
            System.out.println(array.get(i).split(" "));
            
        }

i get: [Ljava.lang.String;@ca0b6

i am supposed to get "10.0.0.2"

Really? Because this particular part would seem to be clearly saying something else

Returns:
the array of strings computed by splitting this string around matches of the given regular expression

Notice the array part.

(Also, there does not appear to be anyone named "u" here at the moment. Use proper English.)

i read it again and i still understand the same thing.

i obiously dont understand how to use it.

can you help me out or not.

It splits on a particular expression, which in your case should be tab, and returns an array of the pieces. If you want the second section then you just need the second element of that array.

This article has been dead for over six months. Start a new discussion instead.