1.Java代码
import java.util.Scanner;
/**
* <p>Project: zixinyuan - OracleUtil
*
* @author zixinyuanya [2991228540@qq.com]
* @version 1.0
* @since 17
*/
public class Ex {
public static void main(String[] args){
Scanner scanner = new Scanner(System.in);
System.out.print("请输入字符串: ");
String t = scanner.nextLine();
if (t.matches("[\u4e00-\u9fa5]+")){
System.out.println("中文:" + t);
}else if (t.matches("[a-zA-Z]+")){
System.out.println("En: " + t);
}else if (t.matches("[0-9]+")){
System.out.println("数字: " + t);
}else {
System.out.println("其它: " + t);
}
}
}
2.执行结果(中文,英文,数字,其它)