Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 16 of 16

Thread: System.out.println("Message");

  1. #1
    Member
    Join Date
    Jan 2012
    Posts
    107
    My Mood
    Grumpy
    Thanks
    6
    Thanked 2 Times in 1 Post

    Exclamation System.out.println("Message"); Console Problem

    So Its Kinda a task/Problem

    When i use the:
    System.out.println("Message");

    It Displays like this:
    |Message
    ^ That being the Mouse Thing.

    I want it to display in the console like this:
    Message|
    ^ That being the Mouse Thing.

    Is there anyway this is possible if there is how so?
    Last edited by Java Programmer; March 27th, 2012 at 05:07 PM.

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: System.out.println("Message");

    You will have to execute that statement BEFORE the statement that prints the "|"
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Forum Squatter newbie's Avatar
    Join Date
    Nov 2010
    Location
    North Wales
    Posts
    661
    My Mood
    Stressed
    Thanks
    28
    Thanked 115 Times in 106 Posts
    Blog Entries
    1

    Default Re: System.out.println("Message");

    I think he's just generally talking about the cursor position, and not an actual String.
    Please use [highlight=Java]//code goes here...[/highlight] tags when posting your code

  4. #4
    Member
    Join Date
    Jan 2012
    Posts
    107
    My Mood
    Grumpy
    Thanks
    6
    Thanked 2 Times in 1 Post

    Default Re: System.out.println("Message");

    Yes i am, I use to know how but i haven't done anything with the console in a long time.

  5. #5
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: System.out.println("Message");

    There is not much positioning done on the console. The main thing you can do is move the cursor to the next line with a new line character.
    If you want the cursor to stay on the same line as what you have printed, do not print a new line char.
    If you don't understand my answer, don't ignore it, ask a question.

  6. #6
    Member
    Join Date
    Jan 2012
    Posts
    107
    My Mood
    Grumpy
    Thanks
    6
    Thanked 2 Times in 1 Post

    Default Re: System.out.println("Message");

    Then what print Should i be using, i tried Printf and it didn't move it to the end as well.

  7. #7
    Member
    Join Date
    Jan 2012
    Posts
    107
    My Mood
    Grumpy
    Thanks
    6
    Thanked 2 Times in 1 Post

    Default Re: System.out.println("Message");

          System.out.printf(num + " + "+num2+" = ");

  8. #8
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: System.out.println("Message");

    Where do you want the cursor after you print? Print a newline if you want the cursor to be on the next line. Don't print a newline if you want the cursor on the same line as what you printed.

    println is the only print method that is defined to go to a newline. For the other print methods it depends on what you print.
    If you don't understand my answer, don't ignore it, ask a question.

  9. #9
    Member
    Join Date
    Jan 2012
    Posts
    107
    My Mood
    Grumpy
    Thanks
    6
    Thanked 2 Times in 1 Post

    Default Re: System.out.println("Message");

    When using Println It goes before the print, if i type it goes to the next line but if you click after the equals in goes where i want it? Hard to understanding how i suppose to print my line in the console without printing it? o.o

  10. #10
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: System.out.println("Message");

    Its hard to have a line printed on the console without printing the line.
    If you don't understand my answer, don't ignore it, ask a question.

  11. #11
    Member
    Join Date
    Jan 2012
    Posts
    107
    My Mood
    Grumpy
    Thanks
    6
    Thanked 2 Times in 1 Post

    Default Re: System.out.println("Message");

    Lol, True.
    I don't know i was wondering if i could fix it but i guess not. ^_^

  12. #12
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: System.out.println("Message");

    wondering if i could fix it
    I have not idea what you are trying to do or what the problem is.
    If you don't understand my answer, don't ignore it, ask a question.

  13. #13
    Member
    Join Date
    Jan 2012
    Posts
    107
    My Mood
    Grumpy
    Thanks
    6
    Thanked 2 Times in 1 Post

    Default Re: System.out.println("Message");


  14. #14
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: System.out.println("Message");

    What kind of console are you printing on? I can't get the cursor to move ahead of a String that is printed.
    If you don't understand my answer, don't ignore it, ask a question.

  15. #15
    Member
    Join Date
    Jan 2012
    Posts
    107
    My Mood
    Grumpy
    Thanks
    6
    Thanked 2 Times in 1 Post

    Default Re: System.out.println("Message");

    Eclipse.
    Extra: Message was to short to post LOL

  16. #16
    Junior Member
    Join Date
    Mar 2012
    Posts
    6
    My Mood
    Mellow
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: System.out.println("Message");

    Why don't you just make it with a textbox and a label?

Similar Threads

  1. use of System.out.println(""); error....
    By rohan22 in forum Java Theory & Questions
    Replies: 2
    Last Post: July 16th, 2011, 10:49 AM
  2. System.out.println("Hello World!")
    By Crixus in forum Member Introductions
    Replies: 1
    Last Post: April 24th, 2011, 10:08 AM
  3. System.out.println ("Hellow");
    By OnionzRingz in forum Member Introductions
    Replies: 1
    Last Post: March 1st, 2011, 05:56 PM
  4. System.out.println("Hi!");
    By 342-173=147 in forum Member Introductions
    Replies: 1
    Last Post: February 27th, 2011, 03:07 PM
  5. System.out.println ("Hello world!")
    By ShaunB in forum Member Introductions
    Replies: 0
    Last Post: December 29th, 2009, 05:17 PM