Topics Index

Datatypes > Primtive Dataypes > Literals >
Siva Nookala - 13 Sep 2016
String Literals In Java is a sequence of characters which has to be included between double quotes ("ex") and should occur on a single line. String Literals Double Quotes example : "string String Literals" Here more than one Character is Defined In Single Line.

String value = "Hello World";
String result = "0.01";
String choice = "a";
String test_string = "Java is an artificial language.";
String with_multiple_lines = "String " +
                "in multiple " +

// Invalid
String invalid1 = 'invalid - string should be in double quotes';
String invalid2 = "invalid string
        in multiple
String literals are objects of the class String, in other words all string literals are of type String.

Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App