Why should I use constructor to initialize instance variables while it is possible at the point of their declaration?
class Frog {
public int x = 4;
Frog() { // Why should I use you }
}
You should use me because I will help you keep your initializations in one place. Because it will help you other colleagues to know where to expect initializations and not miss one if they're scattered aroudn the code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With