![]() |
Java Question (Off topic but technical)
Hey guys, I've done various programming. Mostly scripting but now I'm getting into Java and want to become legit at it so I'm not skimming over shit I get lost at but this one is really perplexing me. So I'm taking this online course and the code below was shown to me, along with the description in the tags and I think I get what its doing but wanted to ask.
Where the heck did "for (int element:array)" come from? How was I supposed to know what that meant and that you could do that? I was confused because as far as I could see "element" never got defined and searching Google didn't turn it up as a keyword or reserved word within Java so.. what the hell is it? I take that its just incrementing across each element and storing the highest values to value and the lowest values to value2, basic stuff but the "for (int element:array)" statement, is that just something I need to accept or is there some ruleset it follows?:confused: I should note I'm confused because up until this point FOR loops mostly took the regular syntax "for (int x=0;x<100;x++)" or whatever. Code:
public static void main(String[] args) { |
All times are GMT -4. The time now is 09:48 AM. |
Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.