Say we have the following classes:
class DoubleOhSeven {
public static void doSomethingClassy();
public static void neverDoThisClassy();
}
class Dude {
public void doSomething();
public void neverDoThis();
}
public class Party {
public static void main(String[] args){
DoubleOhSeven.doSomething();
Dude guy = new Dude;
guy.doSomething();
}
}
Of course, all the methods will be compiled into their respective .class
: do the unused static/instance methods occupy memory at run time? What about unused inherited or imported methods?