I am very new to
Java.
I think the problem in this is that the variable max is initialised as 0. Afterwards it remains in the while loop only, so the output is always 0.
I dont know how to bring the last max value out of loop and print it.
Any help would be appreciated!