I am trying to understand if it is useful to use String during programming, there is general notion in our group that using String is bad practice and enum is way to go but I am not able to find enough reasoning to give in my vote against String and would appreciate any thoughts and example on the issue?
Update:
I should re-phrase my question to word like under what situation usage of String is evil and what alternative dataType you should be using for the same.
Stringis useful and the best way to represent textual data. Strings should not be used to represent:enum). E.g. no"cm","mm","km"as units. Use aUnitenum with these elements.Unit.cm, etc.int,double, etc.)Date,Calendaror joda-timeDateTime)char[]instead, as strings are handled differently by the JVM and the sensitive information may become accessible to an attacker.byte[], you should not use anew String(bytes)to transfer it – you can loose information that way. Strings can represent binary content, if it is encoded – in Base64, Hex, etc.