[Solved] Insufficient Details [closed]


It is pretty hard answering your question without knowing how the file you are scanning is formatted. If it is formatted something like this:

id
name gender age
id
name2 gender age
etc.

You could try something like this:

id = housenumber.next();
line = housenumber.nextLine();
if(input.equals(id))
{    
    //This should the next line instead of just "It's found"
    JOptionPane.showMessageDialog(null,line);

    //Assuming the above file layout, you could then do something like this:
    String[] parts = line.split("\\s+"); //Splits on whitespace

    System.out.println("name: " + parts[0]);
    System.out.println("gender: " + parts[1]);
    System.out.println("age: " + parts[2]);
    break;
}

1

solved Insufficient Details [closed]