I have an abstract class which is inherited by classes that run on different threads. do the variables in this abstract class act as shared memory?
public abstract class A
{
   public abstract void foo();
   public boolean bar(){
   {
      List<String> x=new ArrayList();
      x.add("a");
      //some code
   }
}
public class B extends A
{
   @Override
   public void foo()
   {
     //some code
   }
 }
public class C extends A
{
   @Override
   public void foo()
   {
     //some code
   }
   @Override
   public boolean bar()
   {
      List<String> x=new ArrayList();
      x.add("a");
      //some code
   }
 }
public class D extends A
{
   @Override
   public void foo()
   {
     //some code
   }
 }
classes B, C and D run in different threads. however x is behaving like a shared memory for A and B and D. is it the expected behaviour? if yes how can i make it thread specific without overriding?
 
     
    