I want to end whileloop, regardless of the length. For python a (-1) is returned when the index exceeds the length of the string. But I can't find to work out how to do the same in java.
while(true) {
System.out.println("Letter nur " + (i+1) + " is " + name.charAt(i));
if(name.charAt(i)==-1){
break
}
i = i + 1;
Can I and if yes, how?
forloop instead of awhileloop. This is true for both Python and Java.charAtmethod on string, and indexing past the end would raise an exception.-1as an index?