Can we use multiline String in Java

0 votes
Is it possible to use multiline String in Java?
Jun 19, 2018 in Java by Sushmita
• 6,920 points
753 views

1 answer to this question.

0 votes

It is not possible directly to use Multiline String. 

The best alternative is going to be strings that are just +'d together. 

String s = "Happy Learning,\n"
         + "Welcome,\n"
answered Jun 19, 2018 by sharth
• 3,370 points

Related Questions In Java

0 votes
1 answer

How can we split a comma separated String in Java?

String str = "..."; // write the ...READ MORE

answered Jun 12, 2018 in Java by Parth
• 4,640 points
2,376 views
0 votes
1 answer

Can we convert a string to hexadecimal in java

I find this to be an easy ...READ MORE

answered Jul 4, 2018 in Java by Akrati
• 3,190 points
4,056 views
0 votes
1 answer

How can we use wait and notify in Java?

You can refer to this: synchronized (someObject) { ...READ MORE

answered Jul 12, 2018 in Java by sophia
• 1,400 points
706 views
0 votes
1 answer

How can we encrypt a String in Java?

Let's assume the bytes to encrypt are ...READ MORE

answered Oct 26, 2018 in Java by Sushmita
• 6,920 points
1,440 views
0 votes
2 answers

Result of character addition in Java

Binary arithmetic operations on char and byte ...READ MORE

answered Aug 22, 2019 in Java by Sirajul
• 59,230 points
4,695 views
0 votes
1 answer

Encode String to UTF-8

String objects in Java use the UTF-16 ...READ MORE

answered May 29, 2018 in Java by Rishabh
• 3,620 points
1,394 views
0 votes
2 answers

How to find out a single character appears in String or not in Java?

You can use string.indexOf('s'). If the 's' is present in string, ...READ MORE

answered Aug 7, 2018 in Java by Sushmita
• 6,920 points
5,717 views
0 votes
1 answer

Java URL encoding of query string parameters

I would not use URLEncoder. Besides being incorrectly ...READ MORE

answered Jun 1, 2018 in Java by Rishabh
• 3,620 points
17,557 views
0 votes
3 answers

How can we use java.String.format in Scala?

String aString = "world"; int aInt = 20; String.format("Hello, ...READ MORE

answered Aug 29, 2018 in Java by Daisy
• 8,140 points
1,764 views
0 votes
2 answers

How can I convert a String variable to a primitive int in Java

 Here are two ways illustrating this: Integer x ...READ MORE

answered Aug 20, 2019 in Java by Sirajul
• 59,230 points
2,311 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP