class
apples{
public
static
void
main(String args[]){
int
bucky[]={3,4,5,6,7};
int
total=0;
for(int
x: bucky){
total+=x;
}
System.out.println(total);
}
}
for(int
x: bucky)-->意味著你把變量x和等於列陣bucky,這意味著+= X
= 3+4 +5 +6 +7= 25
thanks!!!!
回覆刪除