Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- import java.util.Scanner;
- public class software {
- public static void main(String[] args) throws IOException{
- String username = getUsername();
- System.out.println(username);
- String password = getPassword();
- writeAccount(username, password);
- System.out.println(password);
- }
- public static int getLength(String input) {
- int length = input.length();
- return length;
- }
- public static String getUsername(){
- String s = scan.next();
- return s;
- }
- public static String getPassword(){
- String x = scan.next();
- return x;
- }
- public static void writeAccount(String username,String password) throws IOException{
- File file = new File(username + ".txt");
- file.createNewFile();
- FileWriter writer = new FileWriter(file);
- writer.write(password);
- writer.flush();
- writer.close();
- }
- static Scanner scan = new Scanner(System.in);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement