title: Why do I get different stacktraces with java.lang.Throwable#getStackTrace and java.lang.Thread#getStackTrace
body: <p>Here is code:</p>
  
  <pre><code>package stacktrace.test;
  
  public class A {
      public static void main(String[] args) {
          B.f();
      }
  }
  
  interface B {
      static void f() {
          C.f();
      }
  }
  
  interface C {
      static void f() {
          StackTraceElement[] stackTrace1 = (new Exception()).getStackTrace();
          StackTraceElement[] stackTrace2 = Thread.currentThread().getStackTrace();
          StackTraceElement x1 = stackTrace1[1];
          StackTraceElement x2 = stackTrace2[1];
          System.out.println(x1.getClassName());
          System.out.println(x2.getClassName());
      }
  }
  </code></pre>
  
  <p>And output:</p>
  
  <pre><code>stacktrace.test.B
  stacktrace.test.C
  </code></pre>
  
  <p>I'check the <code>Thread.currentThread().getStackTrace()</code> it calls <code>(new Exception()).getStackTrace();</code>. In such case why I am getting different result?</p>
  
  <p>Thanks in advance!</p>