A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Refactoring for Software Design Smells: Managing Technical Debt
this week in the
OO, Patterns, UML and Refactoring
Programmer Certification (SCJP/OCPJP)
Joined: Jan 05, 2006
May 30, 2007 04:38:00
static char ch;//implicitly \u0000 default value is assigned for ch
int ia = new int;
at line 3,i am thinking like ia[\u0000] is executed.\u0000 is emptyspace.
then how come ia is printed.
Joined: Aug 03, 2002
May 30, 2007 04:49:00
Here's your mistake:
"\u0000 is emptyspace"
ch is 16 zero bits, and that is 0. The 16 bits are widened to 32 bits but that still results in the array index being 0.
Ask a Meaningful Question
Getting someone to think and try something out is much more useful than just telling them the answer.
Have you checked out
subject: array element
What is the Initial value of char literal?
doubt on char default value...
how many differnt ways can you initialize char ....
can default value of char be used as an index of array?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015