Java String

String Introduction

In general, String is nothing but a sequence of character. For Example, Name is a String.


String “Name” is a sequence of 4 characters i.e. {N,a,m,e} .


Java perspective of String

Java treats String as an object.





String class in java.lang package is used to create String object.



String class implements:

  • Comparable interface
  • Serializable interface
  • CharSequence interface

          String implements by tutorialsinhand.com


String methods

Java provides lot of methods to operate on String. Some of the most commonly used String methods are given below,

  • concat()
  • substring()
  • split()
  • equals()
  • compare()
  • length()
  • toCharArray()
  • toLowerCase()
  • toUpperCase()

We will learn about them and some more methods in details later.


 Important points to remember about String in java

  • In java, String is a class found in java.lang package. This class helps us create String object.
  • String class in java is marked final.
  • String object is immutable in java.
  • String class provides lot of inbuilt methods to work on String object. Refer methods that are pointed in methods section 

Please Share this page
Views : 416
Like every other website we use cookies. By using our site you acknowledge that you have read and understand our Cookie Policy, Privacy Policy, and our Terms of Service. Learn more Got it!