String In Java | PLM Developer

String In Java:

The basic definition of String is "Sequence of Characters", But String is not a primitive data type, It is a class in Java present in java.lang package. It contains several methods to perform operations on data. When you create a string in java, it creates an object of type string.

In Java String is Immutable class which means once you create an Object for String cannot change the value for that. Whenever we try to change the value for the string, It will create a new instance for that. So, you can use StringBuffer and StringBuilder classes to create a mutable string.

String Object in Java:

String str = "PLM Developer";
String str=new String("PLM Developer");

Methods Present In String Class:

int length() : Returns length of the String
boolean isEmpty() : Return boolean value(true/false) after checking whether the string is Empty or Not.
String concat(String str) : Returns string value after concatenates the specified string.
String toUpperCaser() : Returs string uppercase.
String toLowerCase() : Returns string lowercase.
String trim() : Returns string after removing the space before and after.

If you want to know about PLM Click Here

Post a Comment