0
Memory management with method scanner class
method1(int num)//called for scanner class Scanner s=new Scanner (System.in); int num=s.nextInt (); method1(num); will any one explain where this num and s is going to store
2 Answers
+ 5
Objects are stored in the Heap (so as "s") while Local variables are stored in the Stack (so as "num").
https://stackoverflow.com/questions/13624462/where-does-class-object-reference-variable-get-stored-in-java-in-heap-or-stac
https://dzone.com/articles/stack-vs-heap-understanding-java-memory-allocation
0
tq