If I had a library with 3 classes that I included in my java build path as an external lib and it was composed of:
ClassA:
public class ClassA {
public String getData() {
return ClassB.useThis();
}
}
Class B:
public class ClassB {
public static String useThis() {
return "I'm class B.";
}
}
Class C:
public class ClassC {
public int someMethod() {
// Some irrelevant stuff
}
}
And then in my project I did:
System.out.println(new ClassA().getData());
And then exported this as a runnable jar, would Class C be included in this jar regardless of the fact that it's not referenced in any of the other classes or even used?
This has pondered my mind as you see libraries in C++ that are more than 10mb yet the exported executable that uses that library is substantially smaller. So, is this the same case for java?