/** * @author lautturi.com * Java example: new line character in java string */ import java.nio.charset.StandardCharsets; import java.util.*; public class Lautturi { public static void main(String[] args) { String str1 = "hello"; String str2 = "world!"; System.out.println(str1); System.out.println(str2); System.out.println();// print a new line System.out.println(str1+"\r\n"+str2); //print str2 in next line } }
output:
hello world! hello world!