title: Can we create an instance of an interface in Java?
body: <p>Is it possible to create an instance of an interface in Java?</p>
  <p>Somewhere I have read that using inner anonymous class we can do it as shown below:</p>
  <pre class="lang-java prettyprint-override"><code>interface Test {
      public void wish();
  }
  
  class Main {
      public static void main(String[] args) {
          Test t = new Test() {
              public void wish() {
                  System.out.println(&quot;output: hello how r u&quot;);
              }
          };
          t.wish();
      }
  }
  </code></pre>
  <pre class="lang-none prettyprint-override"><code>cmd&gt; javac Main.java
  cmd&gt; java Main
  output: hello how r u
  </code></pre>
  <p>Is it correct here?</p>