This content has been marked as final. Show 5 replies
Kayaman wrote:Yeah but you can't prevent being human and making mistakes ;) People have made plenty of mistakes applying the singleton pattern as well, so either way you're tanked until you test stuff :)
Or you can just decide to create one instance and pass it around, although that would be more error prone.
936517 wrote:No. If you share the enclosing object, the variable will be shared implicitly as well. It could be static, but it's not necessary and in most cases it wouldn't be.
private boolean available=false;
be changed to this?:
private static boolean available=false;
in order to 'share a variable'?