Imam Samudi :
Kevin Anderson :
Test i < args.length
before using args[i]
. You're testing i
at the top of your loop (wrong test, BTW, you want <, not <=), but by that point, it's too late: your while
already accessed args[i]
and died.
Try this instead:
while (i < args.length && !args[i].equals("Dua puluh")) {
textUlang = textUlang + "ulang";
++i;
}
That way, you're always sure that i
is a valid index before you actually try to do args[i]
.
Guess you like
Origin http://43.154.161.224:23101/article/api/json?id=349312&siteId=1