Hello all:
Please help me understand this:
Given the code
class Foo {
static byte a;
static short b;
static char c;
static int d;
static long e;
static
String s;
public static void main(String[] args) {
System.out.println(a+b+c+d+e+s);
}
}
on jdk 1.4 the line (String comes last)
System.out.println(a+b+c+d+e+s);
prints: 0null
and the line (String comes first)
System.out.println(s+a+b+c+d+e);
prints: null00
Why two ceros?
Also, why is i use local variables (initialized variables) the operator behaives different?
String a = "String";
int b = 3;
int c = 7;
System.out.println(a + b + c);
prints: String37
Thanks.