• Register
Welcome to Developerhelpway Q&A, where you can ask questions and receive answers from other members of the community.

What is String in Java? Is String is data type?

+1 vote

What is String in Java? Is String is data type?

I want to know deep idea about java string. So, please help me in deeply.

asked Nov 4, 2015 in Java by Anubhav Chadha

1 Answer

+1 vote

String is not primitive data type like int, long or double. String is a class or in simple world you can say user defined type. String is a Class which is defined in java.lang package and wrappers its content in a character array. String in immutable and final in Java and JVM uses String Pool to store all the String objects. String object using double quotes and overloading of “+” operator for concatenation.

String provides equals() method to compare two String and some other methods like toUpperCase() to convert String into upper case, replace() to replace String contents, substring() to get substring, split() to split long String into multiple String.

The eight primitive data types are: byte, short, int, long, float, double, boolean, and char. The java.lang.String class represents character strings.

answered Nov 5, 2015 by john12 (2,680 points)
It is very nice answer about java string. I got basic information about java string.