Strings in Java

  • Eclipse: Oxygen
  • Java: 1.8

In Java String is a sequence of characters inside double quotes, for e.g., “Java” String is the sequence of 4 characters.

Initialization of String variable

In below example, we will create String. Here var is the reference of data “Hello World” of type String.

String var = “Hello World”;

Unicode symbols can also be stored as String. Unicode is a universal international standard character encoding which represents the most of the language in the world.

String var1 = “\u00BB”;

We have already studied the basics of the string datatype. Here in this tutorial we see the basic methods such as equals to and replace being formed on the strings. These methods along with many more make the usage of string very efficient.

App Class

Output

Studyhard
Text is not Studyeasy

Contributed by Poonam Tomar


VIEW COURSES

Buy me a coffee!

 

PayTM QR (INDIA)

  • Get video tutorials
  • Project files set
  • Get Certified

Leave a Reply

avatar
  Subscribe  
Notify of
Close Menu