I am new to coding and I have a question in Java. Here is my homework problem: Write a program that calls a method called Sum100 that returns the sum of the integers from 1 to 100, inclusive. I have written my method
public int sum100()
{
int sum = 0;
for (int count=1; count <= 100; count++)
sum += count;
return sum;
}
Here is my question: Can I print out my answer from here or do I need to put something in the main like this
public static void main(String[] args) {
System.out.println(sum100());//not working
}