+ 2

Why i cant remove any character from string

see my code and tell what is wrong https://code.sololearn.com/cYJ36w1aaDC0/?ref=app

15th Sep 2017, 4:31 PM
Shobh
Shobh - avatar
3 Réponses
+ 2
+ is used to concatenate strings. - is not a valid operator for strings. If you want to shorten a string, take a look at String.substring(): https://docs.oracle.com/javase/7/docs/api/java/lang/String.html#substring(int,%20int)
15th Sep 2017, 4:56 PM
Jan Schreiber
Jan Schreiber - avatar
+ 2
In many languages Strings are immutable. This means that each time the String is changed a new string must be made in order to replace the old one.
15th Sep 2017, 5:20 PM
josh mizzi
josh mizzi - avatar