i need run this code class temp { public static void function(int [] arr) { int n = arr.length; Hashtable hash = new Hashtable<>(); for(int i=0; i
i need run this code
class temp
{
public static void function(int [] arr)
{
int n = arr.length;
Hashtable<Integer, Integer> hash = new Hashtable<>();
for(int i=0; i<n;i++)
{
if (hash.containsKey(arr[i]))
{
int a = hash.get(arr[i]);
if(a==2)
{
System.out.println("element that is present three times is: "+arr[i]);
}
else
{
hash.put(arr[i], a+1);
}
}
else
{
hash.put(arr[i], 1);
}
}
}
public static void main(String args[])
{
//create an array of 101 elements
int [] arr = { 1, 2, 3, 4, 5, 6, 6, 8, 8, 8};
//call the function
function(arr);
}
}
![O Debug
I Stop
C Share
H Save
{} Beautiry
Language Java
Run
Main.java
18
else
19
{
20
hash.put(arr[i], a+1);
21
}
22
}
23
else
24
{
25
hash.put(arr[i], 1);
26
27
28
29
30
public static void main(String args[])
31
input
stderr
Compilation failed due to following error(s).
Main.java:7: error: cannot find symbol
Hashtable<Integer, Integer> hash = new Hashtable<>();
symbol:
class Hashtable
location: class temp
9:01 PM](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F19c66b33-06ea-4b20-9631-d8d977ee4223%2Fd87a5778-d0fb-46b4-b5b6-b287d6292501%2Fcjy6w6_processed.jpeg&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Step by step
Solved in 5 steps with 3 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)