only in this topic
Open this post in threaded view
What is a string?
In C, C++, a string represents an array of characters (last character ends with ‘\0’).
In Java, a string represents the object of String class. We also have character array in java.
Is String a class or a datatype?
String is a class defined in java.lang package. In Java, every class is considered as user defined data type. So we can take string as a data type.
Ways to create a String:
Method 1: By assigning a group of characters to a string type variable.
<varaible_name> = “string”;
name = “Hari”;
Declaration and assignment can be made by a single statement. This is just a simplification of the above.
String <variable_name> = value;
String name = “Hari”;
To know more about Java Strings Please visit the following url..
Return to Java
1 view|%1 views
Free forum by Nabble
Edit this page