【发布时间】:2011-08-27 16:08:34
【问题描述】:
假设我已经定义了这样的字符串:
private final static String s = "To Be or not to be, that is the question";
在其中一个(静态)方法中,我调用了一个接收字符串作为参数的方法:
methodThatReceivesString(s.charAt(0) + s.charAt(1) + "Inter" + s.charAt(3) + s.charAt(4))
(想法是 methodThatReceivesString() 将传递值“ToInterBe”)
我的问题是:Java 编译器会优化代码,使编译后的二进制文件(.jar .dex)已经包含“ToInterBe”吗?
或者这只会在应用程序运行时发生?
【问题讨论】:
标签: java android optimization compiler-optimization