Computer Science, asked by ruhulkuddus, 3 months ago

what is the differences between'/n' and '/t' in java​

Answers

Answered by mpd20700
0

Answer:

\t : Inserts a tab in the text at this point.

eg:

public class Example_1

{

   public static void main(String[] args)

   {

       System.out.println("Good Morning\t Hello! ");

   }

}

Output:

Good Morning        Hello!

\n : Inserts a newline in the text at this point.

eg:

public class Example_2

{

   public static void main(String[] args)

   {

       System.out.println("Good Morning\n Hello! ");

   }

}

Output:

Good Morning        

Hello!

Answered by prankrisnamanna0155
0

Explanation:

\n is new line charector .It will print the string in next line.

\t is tab charector .It will print a tab

execute to experience

System.out.println("Hellow world")

System.out.println("Hellow \n world")

System.out.println("Hellow \t world")

Similar questions