public class Main {
static void checkAge(int age) {
if (age < 18) {
throw new ArithmeticException("访问拒绝 - 您必须年满18周岁。");
} else {
System.out.println("访问允许 - 您已达到年龄要求!");
}
}
public static void main(String[] args) {
checkAge(15);
}
}