ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
所有的字段都是成员字段,除非修饰符标记为 static 。Static字段用在类上,就像非静态字段用在类的实例上。 > All fields are member fields unless the modifier static is used. Static fields are used “on the class” whereas non-static fields are used “on a class instance”: ~~~ class Main { static function main() { Main.staticField; // static read Main.staticField = 2; // static write } static var staticField:Int; } ~~~ 静态变量(第4.1节)和属性(第4.2节)字段可以使用任意的初始化表达式(第5章). > Static variable (4.1) and property (4.2) fields can have arbitrary initialization expressions (5).