import java.io.File; //import file library
import java.io.FileNotFoundException; //import exception library
import java.util.Scanner; //import Scanner library
class Main {
public static void main(String[] args) {
//create and empty array to hold info from the file
String [] passwordsFromFile = new String [10];
//create a counter for the array position
int arrayPositionCounter = 0;
try
{
//make a scanner AND added a location for the file
Scanner textFileScanner = new Scanner(new File("passwords.txt"));
//read every line
while (textFileScanner.hasNextLine())
{ //loop through file
passwordsFromFile[arrayPositionCounter]=textFileScanner.nextLine();
System.out.println(passwordsFromFile[arrayPositionCounter]);
arrayPositionCounter +=1;
}
textFileScanner.close(); //Stop scanning at the end of the file
}
catch (FileNotFoundException e)
{
System.out.println("OH NO!!!! NO FILE EXISTS!!!");
e.printStackTrace(); //display the specific error
}
}
}
dragon
12345678
qwerty
12345
password
baseball
abc123
shadow
master
696969
666666
monkey
1234567
1111111
1345678
123abc
password12345
2222222
typical
123456789
mustang
tesla
motersport
unity