Create an univocal id in Java -


I have to create a client in Java. A customer has a name, an address, a telephone number and an ID that is the first is. I have implemented it in this way, I want to know that there is a better way to do this.

  public class client {private string name; Private int codeau; Private string address; Private Int Newtel; Private int calculation = 1; Public Client (string name, int code, string address, int newtell) {this.name = name; This.codeU = codeU + count; This.address = address; This.numTel = numTel; Count ++; } Public int getCode () {return codiceU; }}  

The second class that extends the client:

  public class clientgold client {public clientgold (string name, int codeU, string address, int NewTel) is extensively {super (name, code u, address, newtail); // Todo Auto-Generated Constructor Stub}}  

, stable counting , all updated values ​​will remain the same as all the examples of Cliente and this will increase.
Otherwise, counts will always be the same value, which is '1'.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -