发布网友 发布时间:2025-01-14 19:44
共1个回答
热心网友 时间:2025-01-14 20:39
import java.util.Scanner;
public class testIntToString {
public static void main(String[] args) {
Scanner console = new Scanner(System.in);
String str;
System.out.println("input str:");
str = console.nextLine();
boolean isInt = console.hasNextInt();
if (isInt){
if(Integer.parseInt(x)==1||Integer.parseInt(x)==2||
Integer.parseInt(x)==3||Integer.parseInt(x)==4
||Integer.parseInt(x)==5) {
System.out.println("Valid Input!");
}
}
}
}