Is it null for Object type?
class C {
int i;
String s;
public C() {}
}
will "s" be always null ?
What about simple types as int? What will that be? Zero or an arbitrary value?
What about local variables in methods?
public void meth() {
int i;
}
what is the unitialized value of i ?
<Relying on such default values, however, is generally considered bad programming style>
Ok, what do you suggest we do?
class A { String s=""; int i=0; }
OR
class A { String s; int i; public A() { // default constr s=""; i=0; } }
Which is better and why?