更新源代码并且添加不同的参数
This commit is contained in:
parent
3f6fb4cbcb
commit
d7a8a79897
|
@ -3,14 +3,19 @@ package com.ossez.lang.tutorial.usecases;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* variable arguments use case
|
||||
*/
|
||||
public class VarargsCase {
|
||||
private static final Logger logger = LoggerFactory.getLogger(VarargsCase.class);
|
||||
|
||||
/**
|
||||
* sumVarargs
|
||||
*
|
||||
* @param intArrays
|
||||
* @return
|
||||
*/
|
||||
static int sumvarargs(int... intArrays) {
|
||||
static int sumVarargs(int... intArrays) {
|
||||
int sum, i;
|
||||
sum = 0;
|
||||
for (i = 0; i < intArrays.length; i++) {
|
||||
|
@ -20,11 +25,13 @@ public class VarargsCase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Main Function
|
||||
*
|
||||
* @param args
|
||||
*/
|
||||
public static void main(String args[]) {
|
||||
int sum = 0;
|
||||
sum = sumvarargs(new int[]{10, 12, 33});
|
||||
sum = sumVarargs(new int[]{10, 12, 33, 7});
|
||||
logger.debug("The Sum of the arrays: {}", sum);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue