Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory Leak or wastage concept #9

Open
wants to merge 11 commits into
base: develop
Choose a base branch
from
Prev Previous commit
Next Next commit
step 2: monitored memory loss
  • Loading branch information
premaseem committed Jan 9, 2018
commit 25f460bf2415b75a402c11ec7e0c56519410ac4b
6 changes: 5 additions & 1 deletion src/com/premaseem/Calculator.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
@link: https://premaseem.wordpress.com/category/computers/design-patterns/
*/
public class Calculator {

static int num = 0;
public Calculator(){
num++;
System.out.println(num+ " wasting memory with new object");
}
public Integer add(Integer sum, Integer number){
return sum + number;
}
Expand Down