anonymous
  • anonymous
public class tester { int[]alpha= {25,35,45,55}; for(int x= 0; x<=4; x++) System.out.print(alpha[x]+" "); } How can I make it compile?
Computer Science
  • Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
SOLVED
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
katieb
  • katieb
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
anonymous
  • anonymous
first of all you need to have main method secondly in loop you should stop at element 4, e.g. make x<4 instead of x<=4 because it would be out of bounds
anonymous
  • anonymous
How do you write the main method if alpha was already declared?
anonymous
  • anonymous
I have absolutely no understanding of arrays :(

Looking for something else?

Not the answer you are looking for? Search for more explanations.

More answers

anonymous
  • anonymous
wrap evetyhing to main method
anonymous
  • anonymous
you always have to have main method arrays have nothing to do with it
anonymous
  • anonymous
public class tester { public static void main (String[] args) { int[]alpha= {25,35,45,55}; for(int x= 0; x<4; x++) System.out.print(alpha[x]+" "); } }
anonymous
  • anonymous
OH NO DUH!!!
anonymous
  • anonymous
Thank you so much! I was thinking of object oriented programming and I was really confused
anonymous
  • anonymous
Remove the equal sign from for loop of array, as they are zero-index based. It'll always count a index more than your actual array indexes,if you put equal.

Looking for something else?

Not the answer you are looking for? Search for more explanations.