Java 检查它是否为biginteger
我想创建一个while循环来检查用户的输入是否是biginger而不是alpha字符串Java 检查它是否为biginteger,java,input,biginteger,Java,Input,Biginteger,我想创建一个while循环来检查用户的输入是否是biginger而不是alpha字符串 public class Main{ private BigInteger a; public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); a = sc.nextBigInteger(); } } 我不确定我是否理解
public class Main{
private BigInteger a;
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
a = sc.nextBigInteger();
}
}
我不确定我是否理解你的问题。。。但是呢
Scanner sc = new Scanner(System.in);
while (sc.hasNextBigInteger()) {
a = sc.nextBigInteger();
}
这就是你要问的吗?如果没有,,让我知道,我会尝试根据您的回答/评论对其进行相应的编辑,如果您查看
扫描仪API文档,您会看到什么?我投票将此问题作为非主题关闭,因为浏览API文档可以回答问题。while循环在哪里?我想设置while循环,以便在每次biginteger,而不是像“apple”这样的alpga字符串,而(a.isNotBigInteger){从System.in再次读取}