MainClass.java Source code

Java tutorial

Introduction

Here is the source code for MainClass.java

Source

import java.util.Scanner;

public class MainClass {
    public static void main(String args[]) {
        Scanner conin = new Scanner(System.in);

        int count = 0;

        System.out.println("Enter numbers to average.");

        while (conin.hasNext()) {
            if (conin.hasNextDouble()) {
                System.out.println(conin.nextDouble());
                count++;
            }
            if (count == 3) {
                System.exit(0);

            }
        }

    }
}