Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当然,他没有在这里向我们展示实际代码,只是提到了它,我觉得这非常奇怪。
例如,根据他所说,这是有效的 Java:
public class Person { String Name; int Age; { //These two braces just chilling together - VALID? :O } }
是的 - 它是实例初始化程序。您还可以将它与匿名子类一起用于Double-Brace Initialization。