Can someone please tell me why my solution is not good, when the output is right and there are no errors?
package com.codegym.task.task03.task0309;
/*
Sum of 5 numbers
*/
public class Solution {
public static int s=0;
public static void main(String[] args) {
sum();
}
public static void sum()
{
for (int i=1;i<=5;i++)
{
s=s+i;
System.out.println(s);
}
}
}