Why it prints zero and not null | Selenium Forum
M
Posted on 10/08/2016
When we do not initialize a variable and access it from an object why does it print as zero....why doesn't it display null
Like in the below program

public class Test{
int i;
public static void main(String[] args) {
Test t = new Test();
System.out.println(t.i);
}

}

[color=#FF0000:j6iet16c]Why output display as zero, why it does not display as null?[/color:j6iet16c]

Thanks,
Ravi

M
Replied on 10/08/2016

[b:t7b1qur1]Default Values:[/b:t7b1qur1]
boolean=false
char=u0000
int,short,byte=0
long= 0L
float=0.0f
double =0.0d
any reference type= null