Synthetic Class in Java

后端 未结 13 1730
广开言路
广开言路 2020-11-29 17:15

What is a synthetic class in Java? Why should it be used? How can I use it?

13条回答
  •  -上瘾入骨i
    2020-11-29 17:31

    When the Java compiler compiles certain constructs, such as inner classes, it creates synthetic constructs; these are classes, methods, fields, and other constructs that do not have a corresponding construct in the source code.
    Uses: Synthetic constructs enable Java compilers to implement new Java language features without changes to the JVM. However, synthetic constructs can vary among different Java compiler implementations, which means that .class files can vary among different implementations as well.
    reference:docs.oracle.com

提交回复
热议问题