Java Program to create an File and if exists then the user will have the choice to Replace that File or not
import java.io.*; import java.util.*; import system.*; public class ReplaceFiles{ Scanner scan=new Scanner(System.in); String fileName; char ch; public void input(){ try{ System.out.printf("Enter File Name: "); fileName=scan.nextLine(); ReplaceFiles(); } catch(InputMismatchException e){ System.err.println("Error Occured!\n"+e.getMessage()); System.exit(0); } } ...