从键盘输入两个数字,以后完成两个整数的加法操做,不是数字提示错误信息

第一种方法,使用正则表达式正则表达式 Scanner sc = new Scanner(System.in);spa String s = sc.next(); String s2 = sc.next(); if((s != null && s.matches("^[0-9]+$"))&&(s2 != null && s2.matches("^[0-9]+$"))){ System.out.pri
相关文章
相关标签/搜索