whenever I try to run my program it is saying java.lang.NullPointerException at largeNo.main(largeNo.java:15) which is the array push function. How do I fix this?
import java.util.*;
class chutes{
public Stack<Integer> chute = new Stack<Integer>();
}
class largeNo{
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int m = s.nextInt();
int n = s.nextInt();
int largest =0;
String result = new String();
chutes[] c = new chutes[m];
for (int i= 0; i<m; i++ ) {
for (int j =0; j<n; j++ ) {
c[i].chute.push(s.nextInt());
}
}
while(largest>=0){
largest = -1;
for (int i= 0;i<m ;i++ ) {
if(largest<c[i].chute.peek()){
largest = c[i].chute.peek();
}
}
for (int i= 0;i<m ;i++ ) {
if(largest==c[i].chute.peek()){
result += Integer.toString(c[i].chute.pop());
}
}
}
System.out.println(result);
}
}