Search This Blog

save java programs with".java" extension

examples :

helloworld.java
sample.java
match.java
send-mail.java

quick links

default values in java

class defaultdemo
{
byte b;
short s;
int i;
long l;
float f;
double d;
char ch;
boolean bl;
public static void main(String args[])
{
defaultdemo d=new defaultdemo();
System.out.println("byte :"+d.b);
System.out.println("short :"+d.s);
System.out.println("long :"+d.l);
System.out.println("int :"+d.i);
System.out.println("float :"+d.f);
System.out.println("double :"+d.d);
System.out.println("char :"+d.ch);
System.out.println("boolean:"+d.bl);
}
}
====================================================
output :
b :0
s :0
i :0
l :0
f :0.0
d :0.0
char : (single space value)
bl : false