filmov
tv
Java String: Working with Strings in Java Eclipse

Показать описание
Strings are very easy to use in Java. The main thing to watch out for is that appending to strings using the + operator isn't very efficient; it creates new string objects unnecessarily. For most programs this doesn't really matter; but if you're doing lots of string handling and speed is a concern, use StringBuffer (thread-safe) or StringBuilder (not thread-safe but slightly more efficient).
Also, be aware that Java isn't the world's most efficient language for dealing with lots of text data. Perl or Python scripts will generally run much faster than a Java text-processing program.
And finally, don't forget to use .equals() to compare text in strings, not == (which compares objects, not text).
Also, be aware that Java isn't the world's most efficient language for dealing with lots of text data. Perl or Python scripts will generally run much faster than a Java text-processing program.
And finally, don't forget to use .equals() to compare text in strings, not == (which compares objects, not text).