title: how to figure out what class called a method in java?
body: <p>How do I figure out what class called my method without passing any variable to that method?
  let's say we have something like this:</p>
  
  <pre><code>Class A{}
  Class B{}
  Class C{
  public void method1{}
  System.out.print("Class A or B called me");
  }
  </code></pre>
  
  <p>let's say an instance of Class A calls an instance of class C and the same for class B. When class A calls class C method1 method, I want it to print something like "Class A called me", and when class B called it to print "Class B called me". </p>