• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

need java help.

Trezza

Senior member
I need to figure out what my teacher is asking me to do.

Write a class in Java named IterAndRecur which
contains the following static methods.

which returns the sum of all the integers in its
argument array using iteration
public static int iterSum(int[] a)


I usually start my programs with

Public Static Void Main (Strings [] args)

do i do that or this public static int itersum

 
By definition, main is the only method that serves as an entry point into a standalone Java application.

Your assignment is to create a class containing other static methods that do some work.

To create an executable application, you'd still need to write an appropriate main method. Here's sample skeleton code:
public class IterAndRecur {
public static int iterSum(int [ ] a) {
// Implement iterative algorithm
}

public static void main(String [ ] args) {
// Do some work by calling IterAndRecur.iterSum(anIntArray)
}
}
 
Back
Top