/* * 用java求一个整数各位数字之和 */ public class Test02 { public static void main(String[] args) { System.out.println(Test02.sumDig(23865)); System.out.println(Test02.sumDig2(23965)); } public static int sumDig(int n) { int sum = 0; if (n >= 10) { sum += n % 10…