I'm trying to make a Sign Up window on JFrame Form in NetBeans. I have created a class named users
(in the same package) that has a username as String and password as char[]
.
When the username and password are filled, and Sign Up button is pressed, I want to make a new object in the class 'users' so that it's name is taken from username textfield itself.
I want to dynamically create object whose names have been taken from a string.
eg: If I put value of Username as "guy"
, then create users.guy
which has a String = "guy"
and a char[]
as password.
package login;
public class users {
private char[] password;
String username;
users() {
username = "anonymous";
password = null;
}
users(String u, char[] p) {
username = u;
password = p;
}
void putdata() {
System.out.println(username);
System.out.println(password);
}
}
Thanks in advance.