Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

string in java

/* String is a build-in class in java, Yes It's a class, but it is
almost used like any other data types such as int, float, long, etc.
Similar we can use String also. */

What is String ?
String is a collection of characters that are forming from words or sentences.
String object must be in a double quotes.

Simplest way to creating a String -->
String str1 = "This is a String literal";

Explanation  :

String - is a build-in class provided by java.
str1 - is a variable, means variable of type of object is called the reference,
	   however it is most called reference. Hold the String object or point 
       to the String object.
"This is a String" - is a String literal and created in String pool. 
         
 
PREVIOUS NEXT
Tagged: #string #java
ADD COMMENT
Topic
Name
9+1 =