Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - How does java find the sum of the elements of a plastic array in the following two ways?
How does java find the sum of the elements of a plastic array in the following two ways?
Parcel? Testing;

Public? Class? test

{

Public? Static electricity Invalid? main(String[]? Parameter)

{

int[]? arr? =? New? int[]{2,3,4,5,6,7,8 };

system . out . println(sum . sum(arr));

system . out . println(sum 2 . sum(arr));

}

Private? Static electricity Class? Sum2

Public? Static electricity int? sum(int[]? args){

int? sum? =? 0;

For what? (int? Me? :? Parameter)

{

sum? +=? Me;

}

Return? Sum;

}?

}

}

Class? Sum? {

Public? Static electricity int? sum(int[]? args){

int? sum? =? 0;

For what? (int? Me? :? Parameter)

{

sum? +=? Me;

}

Return? Sum;

}?

}