Search:

Type: Posts; User: jjk

Search: Search took 0.14 seconds.

  1. Replies
    8
    Views
    1,133

    Re: Practicing reading from file.

    Yeah, you are correct. I thought it would automatically would be done with split(" ") or split("\\s"), but I need to use split("\\s+"). Then the code works.

    Thank you veru much for your time! :)
  2. Replies
    8
    Views
    1,133

    Re: Practicing reading from file.

    Ok, sorry I misunderstood what you wanted. I changed the code so that in each pass in the while loop it also prints out each of the content in the line array:


    import java.util.*;
    import...
  3. Replies
    8
    Views
    1,133

    Re: Practicing reading from file.

    I added this code in the while loop: System.out.println(Arrays.toString(line));
    And the output became:


    [Tom, , , , , , , , 44]
    [Arnold, , , , , 98]
    [Susie, , , , , , 24]
    [Johnny, , , , ,...
  4. Replies
    8
    Views
    1,133

    Re: Practicing reading from file.

    [Tom, , , , , , , , 44]
    [Arnold, , , , , 98]
    [Susie, , , , , , 24]
    [Johnny, , , , , 17]


    Thanks I used your last codebit, and this is what i got. The problem is in the split it seems. What I...
  5. Replies
    8
    Views
    1,133

    Practicing reading from file.

    Hello, I am practicing reading from a text-file into arrays. I have encountered a problem I am not able to solve.
    I have a file called "nameage.txt":


    Tom 44
    Arnold 98
    Susie 24...
  6. Re: Beginner in Java, something occured which I can't explain.

    Thanks guys, it makes very much sense now.

    Since I have your attention I would like to ask you some general questions about this topic aswell, I hope you can spare the time.
    I have only...
  7. Beginner in Java, something occured which I can't explain.

    Hello, I am very basic to Java. I was programming when something strange occured, I have isolated the problem so that you need to read as little as possible.
    First a short code, where there is...
Results 1 to 7 of 7