import java.io.File; //import file library
import java.io.FileNotFoundException; //import exception library
import java.util.Scanner; //import the 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 //try everything inside the brackets..
{
//make a new scanner and point to file location
Scanner textFileScanner = new Scanner(new File("password.txt"));
//loop through entire file
while (textFileScanner.hasNextLine()){//loop through file
passwordsFromFile[arrayPositionCounter]=textFileScanner.nextLine();
System.out.println(passwordsFromFile[arrayPositionCounter]);//print out line
arrayPositionCounter +=1;
}
//close the file scanner when we're done
textFileScanner.close();
}
catch (FileNotFoundException e){//catch the error
System.out.println("OH NO!!!! NO FILE EXISTS!!!");
e.printStackTrace(); //display the specific error
}
}
}
123456
password
12345678
qwerty
123456789
12345
1234
111111
1234567
dragon
123123
baseball
abc123
football
monkey
letmein
696969
shadow
master
666666
qwertyuiop
123321
mustang
1234567890
michael
654321
superman
1qaz2wsx
7777777