Peace be upon you <3
Say we have:
String str = "hello";
Now I want to find using an if
statement that the length of str
is not greater than 5.
I tried These but it's throwing compiler exceptions:
if(!str.length() > 5) doSomething();
if(!(str.length()) > 5) doSomething();
if(!(str.length() > 5)) doSomething();
Question: How do I tell that the length of str is not greater or smaller than a certain number.
Aucun commentaire:
Enregistrer un commentaire