I wrote a simple java program but it isn't giving any output. It just has to take array input and then print it but on running the program it doesn't produce any output and it is also consuming 60 MB of memory.
import java.util.*;
public class TestClass {
public static void main(String[] args) {
Election obj = new Election();
obj.getVotes();
obj.displayResult();
}
}
class Election
{
int num;
int[] votes=new int[num];
void getVotes()
{
Scanner sc=new Scanner(System.in);
num=sc.nextInt();
//for(int i:votes)
for(int i=0;i<votes.length;i++)
votes[i]=sc.nextInt();
}
void displayResult()
{
//for(int i:votes)
for(int i=0;i<votes.length;i++)
{
System.out.println(votes[i]);
}
}
}