Advertisement
Guest User

Untitled

a guest
Nov 8th, 2016
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.91 KB | None | 0 0
  1. import java.io.*;
  2. import java.util.Scanner;
  3.  
  4. public class software {
  5.     public static void main(String[] args) throws IOException{
  6.         String username = getUsername();
  7.         System.out.println(username);
  8.         String password = getPassword();
  9.         writeAccount(username, password);
  10.         System.out.println(password);
  11.  
  12.     }
  13.    
  14.    
  15.     public static int getLength(String input) {
  16.         int length = input.length();
  17.         return length;
  18.     }
  19.    
  20.     public static String getUsername(){
  21.         String s = scan.next();
  22.         return s;
  23.     }
  24.     public static String getPassword(){
  25.         String x = scan.next();
  26.         return x;
  27.     }
  28.    
  29.     public static void writeAccount(String username,String password) throws IOException{
  30.         File file = new File(username + ".txt");
  31.         file.createNewFile();
  32.         FileWriter writer = new FileWriter(file);
  33.         writer.write(password);
  34.         writer.flush();
  35.         writer.close();
  36.        }
  37.    
  38.     static Scanner scan = new Scanner(System.in);
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement