(When) does it make sense to declare methods static
in this way? Will it save memory? How about the performance?
If I am right, toString()
in the Integer
wrapper class is working like this.
class Address {
private static void method(Address adr) {
// do something
}
public void method() {
Address.method(this);
}
}
class OtherClass {
public static void main(String[] params) {
Address a = new Address();
a.method();
}
}