public static int method1() {
      method2();
      StackTraceElement element = Thread.currentThread().getStackTrace();
      return element.getLineNumber() ;
  }

  public static int method2() {
      method3();
      StackTraceElement[] element = Thread.currentThread().getStackTrace();
      return  element.getLineNumber();
  }
I have tried both ways above but neither work? How do you create a StackTraceElement without the brackets? If someone could point me in the right direction, it would be very helpful. Thanks