File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

array element

 
Shiva Mohan
Ranch Hand
Posts: 484
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
static char ch;//implicitly \u0000 default value is assigned for ch
int[] ia = new int[1];
ia[ch]=5;//line 3
SOP(ia[ch]);

at line 3,i am thinking like ia[\u0000] is executed.\u0000 is emptyspace.
then how come ia[0] is printed.
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic