cannot understand the technique,
please spot the error in my code
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int sum = 0;
while(true)
{
sum = sum + n;
if(sum > 0){
System.out.println(n);
}
else{
break;
}
n = sc.nextInt();
}
sc.close();
}
}