define single dimension array in java and give it values
All Answers
need an explanation for this answer? contact us directly to get an explanation for this answer
need an explanation for this answer? contact us directly to get an explanation for this answer
need an explanation for this answer? contact us directly to get an explanation for this answer
int b[]={4,7,9,3,5};//define single dimension array and give it values directly
int c[]=new int[5];//define single dimension array and determine number of elements inside it.
c[0]=4;//put a value of 4 inside the first element of array c (the address of first element of any array is 0)
c[1]=7; //put a value of 7 inside the second element of array c
c[2]=9;
c[3]=3;
c[4]=5;
need an explanation for this answer? contact us directly to get an explanation for this answer
total answers (2)