thespeedracer38

ClientBrowser

Apr 11th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.69 KB | None | 0 0
  1. /**
  2.  *
  3.  * @author Ranajoy
  4.  */
  5. import java.util.Scanner;
  6. public class ClientBrowser {
  7.     public static void main(String[] args) {
  8.         Scanner sc = new Scanner(System.in);
  9.         System.out.print("Enter the name of your file: ");
  10.         String filename = sc.nextLine();
  11.         System.out.print("Enter the file type: ");
  12.         String filetype = sc.nextLine();
  13.         FileHandler correctFileHandler = FileHandlerFactory.getHandler(filetype);
  14.         if(correctFileHandler != null){
  15.             correctFileHandler.open(filename);
  16.         }
  17.         else{
  18.             System.out.println("The appropriate application for opening " + filetype + " files not found!");
  19.         }
  20.     }
  21. }
Add Comment
Please, Sign In to add comment