Hey, im a really noob at this, but I need some help with this question. I've got to complete this in order to progress to my second year although im not doing programming and will not need it in the second year. The question is as follows:

Given a list of integers and an integer variable declared like this:
List<Integer> list;
int max;

and assuming that some values have been added to the list, write a loop which finds the largest value in list and stores it in max.

To be honest I dont really have a clue what how to write this so any help would be much appreciated. Cheers guys

9 Years
Discussion Span
Last Post by stultuske

You won't need much of anything in second year if you don't pay attention in class and pass the one's required in first year.

Perhaps you should take a look at the "Starting Java" FAQ stickied at the top of this forum if you have no relevant class materials to refer to.


You did a whole year of programming and no one taught you the simple algorithm for looping and finding the max number?


while (list.hasNext()){
System.out.println("been lazy? :P");

I do hope you know the logic in finding a max of a number, eh?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.