從鍵盤輸入兩個數字,以後完成兩個整數的加法操做,不是數字提示錯誤信息

第一種方法,使用正則表達式正則表達式 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
相關文章
相關標籤/搜索