为什么 getAppProperty() 不是静态方法?
getAppProperty(String key) 是 MIDlet 类中的实例方法。既然midlet套件中的所有midlet共享相同的manifest/jad文件,那么为什么它不能是静态方法呢?
getAppProperty(String key) is instance method in MIDlet class. Since all midlet in midlet suite share same manifest/jad file, so why cant it be a static method?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果电话在同一 JVM 进程内运行多个 MIDlet 套件,则它们都共享相同的 MIDlet 类对象。
如果您随后将该方法设置为静态,它将不知道要从哪个 JAD 文件检索信息。
CLDC 和 MIDP 规范都不阻止手机制造商在同一 JVM 进程中运行多个 MIDlet 套件。事实上,在资源有限的环境中这样做效率更高。
If the phone runs several MIDlet suites inside the same JVM process, they all share the same MIDlet Class object.
If you then make the method static, it won't know which JAD file to retrieve information from.
Neither the CLDC nor the MIDP specifications prevent phone manufacturers from running several MIDlet suites inside the same JVM process. It is in fact more efficient to do so in a resource-constrained environment.
这是您询问的关于 J2me 的最紧迫的问题? J2me 又旧又脏,大多数 API 接口都很糟糕。
J2me static 与 getAppProperty 实例的错误程度太低了,我什至认为这个问题不值得回答。
此外,我什至不认为这个问题是可以回答的。
This is the most pressing issue you are asking about J2me? J2me is old dirty and most of API's interfaces suck.
On a scale of things that are wrong with J2me static vs instance of getAppProperty are sooo low I don't even think this question deserves an answer.
Further more I don't even think this question is answerable full stop.