This is my first time and my first question, used this site a lot and love it. So here I go:
currently I learn Java (Java 2 SE), and in my book (Java - A Beginer's Guide (Herbert Schildt)) I managed to get to chapter 5, and am starting to learn about arrays. I can so far initialize and do other stuff but I cannot get this code right...Why does the eclipse say it is wrong? I used the new update with the eclipse but then again...wrong!
Here is the code!
Class MinMax2 {
public static void main(String args[]) {
int nums[] = { 99, -10, 100123, 18, -978, 5623, 463, -9, 287, 49 };
int min, max;
min = max = nums[0];
for(int i=1, i<10, i++) {
if(nums[i]<min) min = nums[i];
if(nums[i]>max) max = nums[i];
}
System.out.println("Min and max: " + min + " " + max);
}
}
Sorry for long text, but remember I am a rookie at this stuff, here I was going to learn about array initializers
int nums[] = {val1, val2, ... valN};
Please help me!