📜  输入非空白字符串的 java 代码 - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:29.303000             🧑  作者: Mango

代码示例1
public static String inputNonBlankStr(String msg){//your message ex:"Enter non blank string:
        String data;
        do{
            System.out.println(msg);
            data = sc.nextLine();
        }while(data.isEmpty());
        return data;
    }