import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int score; try { score = scanner.nextInt(); validateAndPrintScore(score); } catch (ScoreException e) { System.out.println(e.getMessage()); } finally { scanner.close(); } } public static void validateAndPrintScore(int score) throws ScoreException { if (score < 0 || score > 100) { throw new ScoreException("分数不合法"); } else { System.out.println(score); } } static class ScoreException extends Exception { public ScoreException(String message) { super(message); } } }