Results 1 to 9 of 9
Like Tree1Likes
  • 1 Post By amitkumar1924

Thread: is System.out.print same as System.out.println ?

  1. #1
    usuf is offline Member
    Join Date
    Jun 2011
    Posts
    4
    Rep Power
    0

    Default is System.out.print same as System.out.println ?

    started programming .. another one ..

  2. #2
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,755
    Rep Power
    7

    Default

    Wow

    You thought to ask this question on a forum but didn't think to type up a simple bit of code to test the behaviour of each to see if they are the same or different.

    Just use a bit of logical reasioning. Why do you think they would write 2 methods that do exactly the same thing?

  3. #3
    usuf is offline Member
    Join Date
    Jun 2011
    Posts
    4
    Rep Power
    0

    Default

    you mean how each code is different ?

    right ?

    i wont have access to my pc for 3 or four days ... thats why . so i thought why waste my time ...

    thanks .. anyway ..


    i dont know .. to confuse people like you and me i guess

  4. #4
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,336
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by usuf View Post
    i wont have access to my pc for 3 or four days ... thats why . so i thought why waste my time ...
    Yep, it's much better and makes so much sense to try to waste our time; right?

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  5. #5
    usuf is offline Member
    Join Date
    Jun 2011
    Posts
    4
    Rep Power
    0

    Default

    what would be a program that you would try to make ...

    after HelloWorld ?

    in java ...

    i have to learn to write hello world in , let me see ..in five or more languages .. i am really getting sick of this shit ..

    not a proper tutorial or book to be found ..

  6. #6
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,336
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by usuf View Post
    what would be a program that you would try to make ...

    after HelloWorld ?

    in java ...

    i have to learn to write hello world in , let me see ..in five or more languages .. i am really getting sick of this shit ..

    not a proper tutorial or book to be found ..
    You must have a different Google than mine; when I type "Java tutorials" the first link brings me to the (famous) Sun/Oracle tutorials and they definitely know and tell you the difference between print( ... ) and println( ... )

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  7. #7
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    If you want a free resource, use the tutorials Jos mentioned. If you feel like getting a book, try getting "head first java", or read my blog post for some other good books: Helping beginners get started. Sunde's Blog

    Also, to me, the only real usefulness of hello world programs is the get a program compiled(which can be a challenge when new)

  8. #8
    amitkumar1924 is offline Member
    Join Date
    Jun 2011
    Posts
    1
    Rep Power
    0

    Default

    The only difference b/w these two method is

    println :- it will print the output in console with a newline character at the end

    wherease print :- it will print the output in console without any newline character(\n)
    acole5 likes this.

  9. #9
    bigsonny is offline Senior Member
    Join Date
    Nov 2010
    Posts
    164
    Rep Power
    4

    Default

    yes, amitkumar pretty much answered it,so in even more laymen terms, it goes like this:

    print(argument): will print your argument and leave the cursor on the same line (if you could see your cursor).
    println(argument): will print your argument and move to the cursor to the next line. the ln is short for line.

    Don't despair. You'll get better at it and this board is a great resource for help, but please try to show some consideration. When your statement implies that your time is valuable to you, hence why you don't want to waste it doing something that you are asking others to do, this is a bit condescending.

Similar Threads

  1. Loop System print or println statements
    By Singing Boyo in forum New To Java
    Replies: 6
    Last Post: 03-22-2009, 03: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
  •