0
public static void readInput(String str) {
char firstChar = str.charAt(0);
if(!isAlphabet(firstChar))
//throw exception
//continue process
}
最初の文字はASCIIアルファベット(65-122)内にある必要があります。これにはIllegalArguementException
を投げるべきですか?文字列入力パラメータの最初の文字が期待どおりでないときにスローする例外はありますか?
これは合理的な対応です。それはあなた次第です。 – shmosel
それはあなた次第です。 'FirstCharacterIsntWhatIExpectedException'はありません – stdunbar
@stdunbarしかし、OPは1つを書くことができます! :) –