Java Write Program Reads Unspecified Number Integers Finds One Occurrences Input Ends Inpu Q37104184

JAVA ONLY

Write a program that reads an unspecified number of integers andfinds the one that has the most occurrences. The input ends whenthe input is 0. For example, if you entered

2 3 40 3 5 4 – 3 3 3 2 0, the number 3 occurred most often. Ifnot one but several numbers have the most occurrences, all of themshould be reported. For example, since 9 and 3 appear twice in thelist 9 30 3 9 3 2 4, both occurrences should be reported.


Answer


import java.util.Scanner;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.Set;
public class MyClass
{
public static void main(String args[])
{
System.out.println(“Enter the integers:”);
int[] values=new int[1000];
int

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.