There is one stupid question. Why the output of the following program is 0. Code:
import java.util.ArrayList; public class Testing { public static void main(String[] argv) { Stack stack = new Stack(); Mov mov = new Mov(); System.out.println(stack.getSize()); } } class Mov { private int c = 0; public Mov() { Stack stack = new Stack(); for(int i=0;i<15;i++) { c++; stack.push(c); } } } class Stack { private ArrayList<Integer> list = new ArrayList<Integer>(); public void push(int c) { list.add(c); } public int getSize() { return list.size(); } }