title: When lambda function and normal instance function gets memory in java?
body: <p>Below is the piece of code Where I implement lambda to perform various task.</p>
  
  <pre><code>package lambda;
  
  public class Test {
  
      public static void main(String[] args) {
          Test t = new Test();
  
          System.out.println(t.operate(1, 2, (a, b) -&gt; a * b));
      }
  
      private int operate(int a, int b, Calculation method) {
          return method.operation(a, b);
      }
  
      interface Calculation {
          int operation(int a, int b);
      }
  }
  </code></pre>
  
  <p>Now, the question is when and where my <strong>operate</strong> method gets memory?
  and when I cal <strong>t.operate</strong> method using t.operate, when the lambda inside the parameter i.e (a,b)->a+b gets memory.
  Also what are on-demand functions in java?</p>