I was trying to figure out what you want to do with this code - but all in vain... Anyway, the zero that comes after 10 it's the second element of x[c] (don't forget that elements of an array are indexed starting from 0, that means that you are printing elements from x[1] to x[9] and you get 9 zeros - quite predictable) and the first zero of x[c] array comes after 10, because you used System.out.print (not System.out.println !!! which prints a new line after every use). I hope that helped. Regards
On Feb 21, 6:20 pm, franzgabriel <[email protected]> wrote: > as long as I know array is fixed, somebody tell me this code at > constant variable : > > class ArraySample > { > public static void main(String[] args) > { > int []ArrVar1 = {1,2,3,4,5,6,7,8,9,10}; > > //change of fix value array or > //it's means change dimension size of array > final int A = 10000; > int []x = new int [A]; > x = new int [10]; > > for (int a=0; a < ArrVar1.length; a++) > { > System.out.print(ArrVar1[a]); > } > > for (int c=1; c < x.length; c++) > { > System.out.println(x[c]); > } > > } > > } > > ---------------------------------------------------------------------------------------------- > > the output : > > 123456789100 > 0 > 0 > 0 > 0 > 0 > 0 > 0 > 0 > > ---------------------------------------------------------------------------------------------- > > QUESTION : > > 1. why after print number 10 at the end still print default array > value os zero ?? > 2. why 0 value is print only 8 times ? > > I don't understand this, somebody tell me please? --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/javaprogrammingwithpassion?hl=en -~----------~----~----~----~------~----~------~--~---
