title: Static method behavior in multi-threaded environment in java
body: <pre><code>class Clstest{
  
      public static String testStaticMethod(String inFileStr) {
          
          // section 0
          
          // section 1
          
          // do something with inFileStr
          
          // section 2
          
          // section 3
          
          return inFileStr;
  
      }
  
  }
  </code></pre>
  <p>Let's assume there are five threads are each executing a call to <code>Clstest.testStaticMethod(&quot;arg-n&quot;)</code> at the same time.</p>
  <p>Thread 1 calls <code>Clstest.testStaticMethod(&quot;arg-1&quot;)</code>.</p>
  <p>When thread 1 is in the section 1, thread 2 calls <code>Clstest.testStaticMethod(&quot;arg-2&quot;)</code>.</p>
  <p>Then what will happen to Thread 1? Will it go to sleep state?</p>
  <p>When Thread 1 got the chance will it resume the execution from section 1 where it was paused?</p>
  <p>How it happens when there's one <code>Clstest.testStaticMethod</code> and same <code>Clstest.testStaticMethod</code> is shared between all five threads?</p>
  <p>Is there any possibility to interchange the <code>inFileStr</code> sent by multiple threads?</p>