0
0

More than 1 year has passed since last update.

anonymous classのclass name, methodsを確認

Posted at

class name = Outer$1という名前のclass name
methods name = Object's methods + added method

public class Outer {
  public static void main(String[] args) {
      var obj = new Object() {
          public void test() {
              System.out.println("i am test method");
          }
      };
      System.out.println(obj.getClass());
      Method m[] = obj.getClass().getMethods();
      for(Method mc:m) {
          System.out.println(mc);
      }
  }
}
class com.mycompany.mavenproject1.Outer$1
public void com.mycompany.mavenproject1.Outer$1.test()
public final native void java.lang.Object.wait(long) throws java.lang.InterruptedException
public final void java.lang.Object.wait(long,int) throws java.lang.InterruptedException
public final void java.lang.Object.wait() throws java.lang.InterruptedException
public boolean java.lang.Object.equals(java.lang.Object)
public java.lang.String java.lang.Object.toString()
public native int java.lang.Object.hashCode()
public final native java.lang.Class java.lang.Object.getClass()
public final native void java.lang.Object.notify()
public final native void java.lang.Object.notifyAll()
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0