!type
の意味は次のとおりですか?なぜ!
を置くのですか?!このコードでは!タイプの意味は何ですか?
String type = request.getParameter("tipo");
if (type == null) {
out.print("ERROR: The field type wasn't selected<br>");
}
if (!type.equals("auto")
&& !type.equals("trailer")
&& !type.equals("motorcycle")) {
out.print("ERROR: field error ("+type+")<br>");
}
誰かが私にこのコードを特に説明できますか?!type
?
...
あなたのコード内それとも単にテキストが等しくない場合にはチェックを意味等しくない.....:それは、それは例えば、真偽真偽になり、負のウィルhttps://docs.oracle.com/javase/tutorial/java/nutsandbolts/opsummary.html –
'(!type).equals(" auto ")'ではなく、 '!(type.equals(" auto "))'つまり、 '.equals'部分が最初に評価され、その結果に'! 'が適用されます。 – immibis