Strings


A string is a sequence of characters. Strings are very important when it comes to displaying, naming, and describing data. The C and Java languages represent strings in very different ways. In C, a string is represented by an array of characters . The end of the string is designated as such by the null character ' /0 '. The C libraries provide functions to manipulate strings such as the strcpy () , strcat() , and strcmp() functions. When dealing with these functions and with C strings in general you often use pointers.

In Java, strings are represented by the String class and as such are treated as any other reference type. The String class defines a large number of methods for creating, manipulating, and modifying strings. Java strings are immutable. Once a String object is initialized it cannot be changed. If a method is used to modify a string, a new String object is created containing the modified string. Both Java and C support the concept of a string literal. Any text surrounded by double quotes is a string literal.



Technical Java. Applications for Science and Engineering
Technical Java: Applications for Science and Engineering
ISBN: 0131018159
EAN: 2147483647
Year: 2003
Pages: 281
Authors: Grant Palmer

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net