About 7,680,000 results
Open links in new tab
  1. Java Multi-line String - Baeldung

    Jan 8, 2024 · In this tutorial, we'll learn how to declare multiline strings in Java. Now that Java 15 is out, we can use the new native feature called Text Blocks. We'll also review other methods …

  2. java - How can I have toString() return a multi-line string?

    Oct 23, 2014 · To print them on different lines, you need to add a "line break", which is either "\n" or "\r\n" depends on the Operating System you are on. public String toString(){ return …

  3. Does Java have support for multiline strings? - Stack Overflow

    Sadly, Java does not have multi-line string literals. You either have to concatenate string literals (using + or StringBuilder being the two most common approaches to this) or read the string in …

  4. Printing a string of text into multiple lines? Java

    Feb 19, 2013 · First take input using scanner. Then split the inputed line using input.split(" ") and store it into String array. At last print the array using loop or Arrays.tostring() method.

  5. Java Multiline String (with Examples) - HowToDoInJava

    Multiline strings allow the creation of string literals that span several lines of source code. Writing multi-line strings in Java can be approached differently depending on the version of Java you …

  6. How to Print Multi-line Output with System.out.println() in Java?

    In Java, if you want to print multiple lines using a single argument with the `System.out.println()` method, you can insert newline characters (` `) between your desired outputs. This technique …

  7. How to print a string of text into multiple lines? Java

    In Java, you can print a string of text into multiple lines by using the println method or by adding newline characters (\n) to the string itself. Here are two common approaches: Using println …

  8. Java Multiline Strings - Delft Stack

    Oct 12, 2023 · We have different ways to meet the goal of writing multiline strings in java. All of them are listed below, and you use any of them considering your project needs. Use Text …

  9. Mastering Java Multiline Strings: A Comprehensive Guide

    Learn how to effectively use multiline strings in Java with practical examples and best practices for cleaner, more readable code.

  10. How to print a String in multiline Output Java - Stack Overflow

    Dec 2, 2011 · You can do this in a loop to append \n in originial abc. You can use Guava's Splitter. Iterable<String> lines = …

  11. Some results have been removed
Refresh