用String 打印 split平均分
package com.StringExcrise;
public class demo3 {
public static void main(String[] args) {
//数据
String[] Stus = {"销售_数学_12","都是_数学_13","欧欧_数学_42"};
for (int i = 0; i < Stus.length ; i++) {
String s = Stus[i];
System.out.println(s);
String[] s1 = s.split("_");
String name = s1[0];
String fenshu = s1[2];
double avg = (Integer.parseInt(fenshu))/3.0;
System.out.println(name + "的平均分是 "+ avg);
}
}
}