I've made a program a checks whether the username and & password are correct or not, but I want to open a file with a defined path if they are correct. How do I do that? This is what I've tried:
import java.util.Scanner;
import java.io.*;
public class Login {
public static void main(String[] args) {
int pass;
String un;
String file_name = "C:/Users/Username/Desktop";
System.out.println("Welcome, please enter the username and password");
Scanner scan = new Scanner(System.in);
System.out.println("Username?:");
un = scan.nextLine();
System.out.println("Password?:");
pass = scan.nextInt();
if (un.equals("Admin") && pass == 123) {
System.out.println("That's correct");
Readfile file = new Readfile(file_name);
String[] aryLines = file.OpenFile();
} else {
System.out.println("You ain't the Admin");
}
}
}
The login checker works, but I can't open the file. It says among other that Readfile cannot be resolved to a type