Java UserGenerator(输出1000个数据)

时间:2016-08-22 06:45:06

标签: java generator

我想用Java编写UserGenerator。我必须以表格格式输出1000个用户名/密码。任何一个想法?

enter image description here

1 个答案:

答案 0 :(得分:0)

虽然我不太了解你的需要,但仍然为你写了一个快速的程序。

public class Test {

public static void main(String[] args) {
    System.out.println("USERNAME, PASSWORD, EMAIL, FIRST_NAME, LAST_NAME");

    for (int i = 0; i < 5; i++) {
        String username = "test" + i;
        String password = "password" + i;
        String email = "test" + i + "@test.com";
        String firstName = "test".toUpperCase() + i;
        String lastName = "test".toLowerCase() + i;

        System.out.println(username + ", " + password + "," + email + "," + firstName + "," + lastName);
    }

}

}

输出 -

USERNAME, PASSWORD, EMAIL, FIRST_NAME, LAST_NAME
test0, password0,test0@test.com,TEST0,test0
test1, password1,test1@test.com,TEST1,test1
test2, password2,test2@test.com,TEST2,test2
test3, password3,test3@test.com,TEST3,test3
test4, password4,test4@test.com,TEST4,test4