hi!! i'm a beginner on java. i've read some books but have not come across default value for a char. if i declare a char without initialising the system exits at the point the value is get? what is the reason?
Amit, The default value for a char is <code>\u0000</code>, a Unicode 0. Only class and instance variables are automatically initialized with their default values. If you are using an uninitialized local variable you will run into a compile error. Hope that helps. ------------------ Jane
It didn't exit because the char was uninitialized. It ended because it was over. The uninitialized char c printed as a blank and that was the last command. Try adding this: System.out.println ("Char = "+c); System.out.println ("Unicode = "+"\u0000");
"JavaRanch, where the deer and the Certified play" - David O'Meara