dear all, i want to try catch this. i want a message to appear before it asks for the password..pleas e help me out..
Code:
import java.util.Scanner;
import javax.swing.*;
import java.io.*;
public class BackItUpTxt
{
public static void main(String agrs[]) throws IOException
{
String D_Play = "File does not exist!";
try
{
Scanner yeet1=new Scanner(System.in);
System.out.println("Enter file that you want to backup:");
String yeet2=yeet1.nextLine();
System.out.println("Enter password to secure your backup:");
String yeet3=yeet1.nextLine();
for (int count =6; count > 0 && yeet3 != "acbt"; count--)
{
System.out.println("Wrong password. " + (count-1) + " attempts left.Enter password again:");
yeet3=yeet1.nextLine();
}
Encrip.encrip(yeet3,yeet2);
Backup.backup(yeet2);
}
catch(FileNotFoundException e){
JOptionPane.showMessageDialog (null,D_Play);
System.exit(-1);
}
}
}
Comment