I have a class like this (which I am developing)-
public class Comp { private String name; }
It is used in some other classes(which will be used by others and not in my control), like this
Comp username;
Comp password;
What I want is, to set the name of the Comp object automatically same as the name of the instance created. That is in my case, it should return like this -
username.getName() -> "username"
password.getName() -> "password"
I need to do this on my side(that is, in the Comp class). Is this possible to achieve ?
Aucun commentaire:
Enregistrer un commentaire