Interesting Thing That I Learned !!

Boring thing to other but interesting to me !!

System.out.print()
System.out.println()
System.out.print(“\n”)

What is the different between this three lines code ?

System.out.print();

prints text without adding a new line at the end


This content originally appeared on DEV Community and was authored by Abishek

Boring thing to other but interesting to me !!

  1. System.out.print()
  2. System.out.println()
  3. System.out.print("\n")

What is the different between this three lines code ?

  1. System.out.print();
  • prints text without adding a new line at the end
System.out.print("Hello ");
System.out.print("World!");

o/p
Hello World

where to use:

  • When you want to continue printing on the same line.
  • Example: Loading indicators, progress messages.
  1. System.out.println()
  2. Prints text and moves to the next line automatically.
System.out.println("Hello");
System.out.println("World!");

o/p
Hello
World

where to use:

  • When you want each output to appear on a new line.
  • Example: Displaying lists, logging, or structured outputs.

3.System.out.print("\n")

  • same as println but you manually insert a newline using \n.
System.out.print("Hello\n");
System.out.print("World!");

o/p
Hello
World

where to use:

  • When you need custom placement of newlines inside a single string.
  • Example: Multi-line messages, formatted tables.

Found a shortcut to type easily System.out.println() in IntelliJ

--> Type sout in the intellij, it automatically print System.out.println(). i think it's only work in inteelij.

Recalling my memories

what is declaration and initialization in java?

Declaration:
declared the int (int)

public class Variable {  
    public static void main(String[]args){  
        int a;  
        System.out.println(a);  
    }  
}

o/p
java: variable a might not have been initialized

Initialization:
initializing the value (int=5)

public class Variable {  
    public static void main(String[]args){  
        int a=5;  
        System.out.println(a);  
    }  
}

o/p
5

## HAPPY 19th BIRTHDAY !!!

  • now i'm a part of linux mint community.little weight distro and beginner friendly.
  • It is one of the best alternatives to Microsoft Windows and Apple MacOS.
  • Linux Mint is a community-developed Linux distribution based primarily on Ubuntu, with an alternative version based on Debian known as Linux Mint Debian Edition (LMDE). It is available for x86-64 systems, while LMDE also supports the IA-32 architecture. First released in 2006, Linux Mint is often noted for its ease of use, out-of-the-box functionality, and appeal to desktop users.[7][8] It comes bundled with a selection of free and open-source software. The default desktop environment is Cinnamon, developed by the Linux Mint team, with MATE and Xfce available as alternatives more to know https://en.wikipedia.org/wiki/Linux_Mint

signing off!!!


This content originally appeared on DEV Community and was authored by Abishek


Print Share Comment Cite Upload Translate Updates
APA

Abishek | Sciencx (2025-08-28T15:46:00+00:00) Interesting Thing That I Learned !!. Retrieved from https://www.scien.cx/2025/08/28/interesting-thing-that-i-learned/

MLA
" » Interesting Thing That I Learned !!." Abishek | Sciencx - Thursday August 28, 2025, https://www.scien.cx/2025/08/28/interesting-thing-that-i-learned/
HARVARD
Abishek | Sciencx Thursday August 28, 2025 » Interesting Thing That I Learned !!., viewed ,<https://www.scien.cx/2025/08/28/interesting-thing-that-i-learned/>
VANCOUVER
Abishek | Sciencx - » Interesting Thing That I Learned !!. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/08/28/interesting-thing-that-i-learned/
CHICAGO
" » Interesting Thing That I Learned !!." Abishek | Sciencx - Accessed . https://www.scien.cx/2025/08/28/interesting-thing-that-i-learned/
IEEE
" » Interesting Thing That I Learned !!." Abishek | Sciencx [Online]. Available: https://www.scien.cx/2025/08/28/interesting-thing-that-i-learned/. [Accessed: ]
rf:citation
» Interesting Thing That I Learned !! | Abishek | Sciencx | https://www.scien.cx/2025/08/28/interesting-thing-that-i-learned/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.