Does javac removes methods that are not referenced in the code?
I have a code base and some methods are never used. Does javac remove the unused methods from the class file? 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: No. What goes into the class, stays in the class file. ... however ... The JVM loads only what's needed into memory. RAM isn't "wasted" on unused classes. No, it doesn't. To verify this, you can run javap -c foo.bar.MyClass and see all the code there. You can also access it via reflection (assuming you're running with appropriate permissions). No it