I have to make a class housenumber. The housenumber consists of an int and a char. The housenumber will be assigned to another class House where Person can live.
What I want to do:
Whenever an object housenumber is created I want it to check if it's the same as another one or not. But only if another object has been created.
What I think could be useful:
So whenever an object is created we run the method control(); The method control is a boolean and should return true if they are the same. I know .equals(object) can be used but I don't know how to get an object in there. Lets say I create a. It should check if b is created but because there isn't hè returns a true value and the object can be created. If I create b. It will check and Find a exists. Then if b!=a it will return a false value and b can be created. If a==b it will return false and b will just be set to a (point to the same variables and stuff)
I hope it's not too vague