String concatenation and line breaks

filename.rb


class Abc
    public static void main(String[] args) {
        System.out.println("Hello." + "How are you?\n I'm fine.");
    }
}

Use "+" to concatenate strings. Since line breaks cannot be made in the middle of a string literal, the indent can be cleaned up by using it when the string is too long to fit on one line. You can also use the newline character "\ n" to start a newline. In this case, "I'm fine" is displayed with a line break.

Recommended Posts

String concatenation and line breaks
String and stringbuffer and string builder
String literals and instances
[Java] String comparison and && and ||
In fact, Ruby distinguishes between line breaks and whitespace.
[Java] About String and StringBuilder
Remove consecutive line breaks and tabs before and after in Java
A trick when you want to insert a lot of line breaks and tabs when substituting a character string
About the difference between gets and gets.chomp (other than line breaks)
[Java] Speed comparison of string concatenation
String, heap area and constant pool
text as bitmap And New Line
Studying Java 8 (String Joiner and join)
String operations this and that-Java edition-