This code
public static void main(String [] args){
int c[] ={10,21,34,36,90,33,44,5};
int tot = 0;
for(int i:c){
System.out.println(c);
}
}
Prints out
[I@1242719c
[I@1242719c
[I@1242719c
[I@1242719c
[I@1242719c
[I@1242719c
[I@1242719c
[I@1242719c
I know I’m supposed to print out the int variable, but I’m curious as to what this means. Thanks
You’re printing out the internal representation of
c. Essentially[I@1242719cbreaks down to two important things. First, the[indicates that you’re printing an array. Second, theIindicates that it’s an integer. Therefore, you’re printing an array of integers! Try replacing the integer array with a string array and watch theIget replaced accordingly. From this page: