Java String Class Tutorial

Java 8Object Oriented ProgrammingProgramming

The java.lang.String class represents character strings. All string literals in Java programs, such as "abc", are implemented as instances of this class. Strings are constant, their values cannot be changed after they are created.

Example

public class StringDemo {
   public static void main(String args[]) {
      String string1 = "saw I was ";
      System.out.println("Dot " + string1 + "Tod");
   }
}

Output

Dot saw I was Tod
raja
Published on 09-Feb-2018 15:12:35
Advertisements