Online Java Compiler By
JavaTpoint.com
//import statement import java.lang.reflect.Method; public class ReflectMethodisSyntheticExample1 { private String x = "22"; private class MyInnerClassX1 { private void process() { System.out.println(x); } } public static void main(String... args) { for (Method mthd : ReflectMethodisSyntheticExample1.class.getDeclaredMethods()) { if (mthd.isSynthetic()) { System.out.printf(" Synthetic method%s%n name:%s%n", mthd, mthd.getName()); } } } }
Output