参考代码:
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println((judge(scanner.next())) ? "yes" : "no"); } public static boolean judge(String s) { if(s.charAt(0) >= '0' && s.charAt(0) <= '9') return false; for(char x: s.toCharArray()) if(x >= '0' && x <= '9' || x >= 'a' && x <= 'z' || x >= 'A' && x <= 'Z' || x == '_') ; else return false; return true; } }
0.0分
5 人评分