Menu
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.

e.g.,
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 " +
                "lines";

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

0
Wrong
Score more than 2 points

© meritcampus 2016 - 2017

All Rights Reserved.