import java.io.File;//import file liabary
import java.io.FileNotFoundException; //import execption libary
import java.util.Scanner;// import the scanner libary
class Main {
public static void main(String[] args) {
String [] PasswordsFromFile = new String [10];
int arrayPositionCounter = 0;
try{
//make a scanner
Scanner textFileScanner = new Scanner(new File("Passwords.txt"));
//loop through the file and read everyline
while (textFileScanner.hasNextLine())
{
PasswordsFromFile [arrayPositionCounter]=textFileScanner.nextLine();
System.out.println(PasswordsFromFile[arrayPositionCounter]);// print out the line
arrayPositionCounter +=1;
}
// close the file scanner when we're done
textFileScanner.close();//stop Scanning at the end of the file
}
catch(FileNotFoundException e) //catch the error
{
System.out.println("oh no.... no file exists");
e.printStackTrace();//display the specific error
}
}
}
23456
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