Results 1 to 6 of 6
  1. #1
    aconti is offline Member
    Join Date
    May 2011
    Posts
    39
    Rep Power
    0

    Default skip a line between 2 system.out.println messages

    Hello,

    basic question, I just want to skip a line between two system.out.println messages

    Thanks !

  2. #2
    goldest's Avatar
    goldest is offline Senior Member
    Join Date
    Oct 2009
    Location
    Pune, India
    Posts
    469
    Rep Power
    5

    Default

    Quote Originally Posted by aconti View Post
    I just want to skip a line between two system.out.println messages
    This is a bit confusing. What is your exact requirement?

    Goldest
    Java Is A Funny Language... Really!
    Click on * and add to member reputation, if you find their advices/solutions effective.

  3. #3
    kjkrum's Avatar
    kjkrum is offline Senior Member
    Join Date
    Apr 2011
    Location
    Tucson, AZ
    Posts
    1,060
    Rep Power
    6

    Default

    Calling System.out.println() with no argument will output a blank line. Is that what you mean?
    Get in the habit of using standard Java naming conventions!

  4. #4
    goldest's Avatar
    goldest is offline Senior Member
    Join Date
    Oct 2009
    Location
    Pune, India
    Posts
    469
    Rep Power
    5

    Default

    Quote Originally Posted by kjkrum View Post
    Calling System.out.println() with no argument will output a blank line.
    ... And even the escape sequence "\n" would also do the same. But the OP hasn't yet confirmed what he actually wants.

    Goldest
    Java Is A Funny Language... Really!
    Click on * and add to member reputation, if you find their advices/solutions effective.

  5. #5
    aconti is offline Member
    Join Date
    May 2011
    Posts
    39
    Rep Power
    0

    Default

    I used Calling System.out.println() and it left a space between the 2 outputs

    thank you

  6. #6
    goldest's Avatar
    goldest is offline Senior Member
    Join Date
    Oct 2009
    Location
    Pune, India
    Posts
    469
    Rep Power
    5

    Cool

    Quote Originally Posted by aconti View Post
    I used Calling System.out.println() and it left a space between the 2 outputs
    Good to know that.

    But if you ever feel that the blank println statements don't make much sense, you can go for the escape sequence as well. Like,

    Java Code:
    System.out.println("A");
    System.out.println();
    System.out.println("B");
    
    // Is as same as below,
    
    System.out.println("A\n");
    System.out.println("B");
    Hope that helps,

    Goldest
    Java Is A Funny Language... Really!
    Click on * and add to member reputation, if you find their advices/solutions effective.

Similar Threads

  1. Println VS system.out.println
    By ccie007 in forum New To Java
    Replies: 2
    Last Post: 05-20-2010, 08:52 AM
  2. difference between system.out.println() & out.println()
    By wickedrahul9 in forum Advanced Java
    Replies: 5
    Last Post: 10-18-2008, 11:06 PM
  3. System.out.println
    By Sniper-X in forum Advanced Java
    Replies: 10
    Last Post: 05-05-2008, 03:41 PM
  4. System.out.println
    By sunjavaboy in forum Advanced Java
    Replies: 3
    Last Post: 03-22-2008, 01:30 AM
  5. Help me with system.out.println
    By baltimore in forum New To Java
    Replies: 1
    Last Post: 07-31-2007, 08:30 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •