I would like to say that I have an 1 day experience with java,therefore if its a bit easy question, sorry about that.
Now, I want to show my piece of code .
I have a string array like :
String [] attributeNames[4];
I've read 4 name each of which are 64 bytes from binary file and store them into this array. (attribute name contain null-ended string max 64 byte) And then I want to print my attributeNames array and their length however, If I write :
for(int i=0;i<attributeNames2.length;i++){
System.out.println(
attributeNames2[i] +
" length: "+attributeNames2[i].length()
);
}
I got only
pathway
shortest_path
path_length
avg_neighbour_number
as a result . Length are not printed but If I write
for(int i=0;i<attributeNames2.length;i++){
System.out.println(
"length:"+attributeNames2[i].length() +
"names:"+ attributeNames2[i]
);
}
I got
length: 64 pathway
length: 64 shortest_path
length: 64 path_length
length: 64 avg_neighbour_number
I wonder why ? Is there anyone to help me ?