In Java, I need to write a while loop that will run for 10 seconds and after every 50 loops it will print the number of loops run so far in that set time.
Break the solution down into steps.
First make a java program.
Then make a loop that runs for 10 seconds inside the program.
Once this part works, add a counter to count the loops for the whole 10 seconds and print that out.
After that works well, throw some logic in there to cause the print every 50 loops instead of just once at the end.
Also please note:
System.currentTimeMillis()
does not start a timer at zero. Use your favorite search engine to determine what value the method returns.