I get an infinite loop..i also tried with if and break but still got an infinite loop.. what am i missing thanks
package com.codegym.task.task05.task0529;
import java.io.BufferedReader;
import java.io.InputStreamReader;
/*
Console-based piggy bank
*/
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
String str = buf.readLine();
int sum=0;
while(!str.equals("sum")){
sum = sum + Integer.parseInt(str);
}
System.out.println(sum);
//write your code here
}
}