Hello I need to find the line numbers at which the longest word in a file appears. If there are two or more different words of the same longest length, then track the first one only. I have done the tracking of the longest word but I need help finding what lines the longest word is in. This is my code that finds the longest word:
while(scan2.hasNextLine()){
String line = scan2.nextLine();
if(line.contains(longestWord)){
longestWordList.add(longestWord);
}
else{
longestWordList.add(null);
}
}
