java - non abstract methods of abstract class thread safe -


i have abstract class non abstract methods. want know if these non abstract methods thread safe default?

to make question more clear, here example

public abstract class animal {   private list foo;   non abstract method survive() {     //bla bla bla     foo++;     foo = foo * 2     foo = nul     //bla bla bla   }     abstract method eat();   abstract method sleep(); }  public class cat extends animal {   eat();   sleep(); }  public class dog extends animal {   eat();   sleep(); }  //etc etc 

if both cat , dog wants survive @ same time, java takes care of default? or should make animal.survive() method synchronized?

well, there no problem @ all, because dog , cat independent objects --> no synchronization problems...


Comments

Popular posts from this blog

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -