Displaying Multiple Lines of Text with a Single Statement - Java Language Basics

Java examples for Language Basics:Hello World

Introduction

Escape sequence Description
\n Newline.
\t Horizontal tab.
\r Carriage return.
\\ Backslash.
\" Double quote. System.out.println("\"in quotes\""); displays "in quotes".

Demo Code

public class Main 
{
   // main method begins execution of Java application
   public static void main(String[] args)
   {/*w  w  w . j a v a2s .c o  m*/
      System.out.println("Welcome\nto\nJava\nProgramming!");
   } 
}

Result


Related Tutorials