MyClass.java
 

public class MyClass {
  public static void main(String[] args) {
    String txt = "Hello\nWorld!";
    System.out.println(txt);
  }
}

Result:
Hello
World!