| > > Hi, if I do:
| >
| > > char cop[] = new char[30];
| >
| > > and then
| >
| > > System.out.print(cop[0]+" +++ ");
| >
| > > why is the output an empty string and not +++ ?
| >
| > > Thanks
| >
| > Hint: What are the initial values of the elements of cop?
| > What about the character with Unicode code 0?
| > Maybe some research about "null terminated strings" can help.
|
| if cop is an array of char when I create it with 'new' it
| should have a reference to an object of array of char with 30
| cells with empty chars. But I don't understand that output!
Depending on how your system handles I/O, you may also need to write out a
line terminator (cr / lf) or otherwise flush the output buffer. See what
println gives instead of print. Also, are you sure you recompiled? -- this
exercise works for me.
Matt Humphrey (e-mail address removed)://
www.iviz.com/