Hi there, I am having a problem using this scanner. I would like to find a specific value in the text file
inside of my textfile is:
1 iamSamantha 143iluvu Samantha Jones 23 Female
2 AdamLambert ilove8 Adam Lambert 25 Male
3 saharaDoneth doneth123 Doneth Sahara 28 Female
heres my code:
String firstName="";
try{
fileRead=new FileReader(myFile);
scan=new Scanner(myFile);
while(scan.hasNext()){
if(scan.next.equals(iamSamantha)){
firstName=scan.next();
} scan.nextLine();
} scan.close();
}catch(Exception e){
}
I want to display the firstName using the username iamSamantha.
Thanks for the help..