javac是否会删除代码中未引用的方法? [英] Does javac removes methods that are not referenced in the code?
本文介绍了javac是否会删除代码中未引用的方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个代码库,某些方法从未使用过.
javac
是否从类文件中删除未使用的方法?
I have a code base and some methods are never used.
Does javac
remove the unused methods from the class file?
推荐答案
问:我想知道我是否有代码库,并且从未使用过某些方法. javac会从类文件中删除未使用的方法吗?
Q: I want to know if I have a code base and some methods are never used. Does javac remove the unused methods from the class file?
A:否.进入班级的内容保留在班级文件中.
A: No. What goes into the class, stays in the class file.
...但是...
JVM仅将所需的内容加载到内存中. RAM未在未使用的类上浪费".
The JVM loads only what's needed into memory. RAM isn't "wasted" on unused classes.
这篇关于javac是否会删除代码中未引用的方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文