import java.util.Scanner;
public class test {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("請輸入資料:");
String in = sc.nextLine();
if(checkNum(in)){
System.out.println("輸入的數字為80-160!");
}
else{
System.out.println("輸入的資料不在範圍內!");
sc.close();
public static boolean checkNum(String str){
return str.length() < 4 && str.matches("[8-9][0-9]|[1][0-5][0-9]|160");
import java.util.Scanner;
public class test {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("請輸入資料:");
String in = sc.nextLine();
if(checkNum(in)){
System.out.println("輸入的數字為80-160!");
}
else{
System.out.println("輸入的資料不在範圍內!");
}
sc.close();
}
public static boolean checkNum(String str){
return str.length() < 4 && str.matches("[8-9][0-9]|[1][0-5][0-9]|160");
}
}