How can I make a new instance of an object in Java? -


i making simple email application in java. have account class. each account class has username , password attribute. want able create new instance of account class class. how can this? seems should simple can't seem figure out.

if account has copy constructor, it's trivial:

account newaccount = new account(otheraccount); 

if not, can like

string username = otheraccount.getusername(); string password = otheraccount.getpassword(); account newaccount = new account(username, password); 

obviously had make of these method names , things, idea.


Comments