I am writing a program that uses a while loop to determine the largest number input so far. I have to input 10 numbers in whole. At the end of the loop, it should output the two largest number.
Code:
import java.util.Scanner;
public class Largest
{
public static void main(String[] args)
{
int counter = 1;
int number;
int largest = 0;
int number2;
Scanner input = new Scanner(System.in);
while (counter < 10)
{
System.out.println("Enter a number");
number = input.nextInt();
// ???
}