String Literals in Java Programming
Previous | Home | Next |
The string of characters is represented as String literals in Java.
Strings, which are widely used in Java programming, are a sequence of characters.
In the Java programming language, strings are objects.
The string of characters is represented as String literals in Java.
In Java a string is not a basic data type, rather it is an object.
There are few methods provided in Java to combine strings,
modify strings and to know whether to strings have the same value.
We represent string literals as
String str = "How are you?";
The above example shows how to represent a string. It consists of a series of characters inside double quotation marks.
char[] hArray = { 'h', 'e', 'l', 'l', 'o', '.'};
String helloStr = new String(hArray);
System.out.println(helloStr);
Previous | Home | Next |