Explore BrainMass

Java : Product of a series of integers

Write a Java application that calculates the product of a series of integers that are passed to method "product" using a variable-length argument list. Test your method with several calls, each with a different number of arguments.

Solution Preview

Following Java application demonstrates a definition of "product" method along with several calls. Copy it into SeriesProduct.java and run as "java SeriesProduct.java".

public class SeriesProduct
// Calculate the ...

Solution Summary

Solution demonstrates how to define a java method that can take variable number of arguments. It also shows how these arguments can be accessed in the method with the help of "enhanced for statement".