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 3 of 3

Thread: System.out.println, beside each other?

  1. #1
    Member
    Join Date
    May 2014
    Posts
    36
    Thanks
    6
    Thanked 3 Times in 3 Posts

    Default System.out.println, beside each other?

    I'm tasked with making a bowling scoreboard, wich for the most part works, however, I'm wondering how I go about printing player1, player2, or whatevers scoreboard beside each other, I currently get this:
    Frame: 1
    Worp 1: X
    Worp2: -
    -----
    Frame: 2
    Worp 1: X
    Worp2: -
    -----
    Frame: 3
    Worp 1: X
    Worp2: -
    -----
    Frame: 4
    Worp 1: 9
    Worp 2: -
    -----
    Frame: 5
    Worp 1: X
    Worp2: -
    -----
    Frame: 6
    Worp 1: 8
    Worp 2: 1
    -----
    Frame: 7
    Worp 1: 7
    Worp 2: 1
    -----
    Frame: 8
    Worp 1: 3
    Worp2: /
    -----
    Frame: 9
    Worp 1: 2
    Worp 2: 2
    -----
    Frame: 10
    beurt 1: X
    beurt 2: 2
    beurt 3: 3
    -----
    -----
    Score: 154

    Is there a way to tell my program that it needs to start it's printline beside the already in place output?

    Edit: so that it would be:
    Player 1: Player 2:
    Frame 1: Frame 1
    Turn 1: Turn 1
    Turn 2: Turn 2

    Instead of what i now have,
    Player 1:
    Frame 1
    Turn 1:
    Turn 2:

    Player 2:
    Frame 1
    Turn 1:
    Turn 2:
    Last edited by Time4Java; May 27th, 2014 at 03:27 PM.
    English is not my native language (Typo alert).


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: System.out.println, beside each other?

    1) Use string addition in System.out.println 2) See the API for PrintStream (Java Platform SE 7 ) , which System.out is an instance of - in particular the print() method may be of use. Either way, you may have to re-organize your print statements to get what you desire - tough to give advice on this without code.

  3. #3
    Junior Member
    Join Date
    May 2014
    Location
    manila, philippines
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: System.out.println, beside each other?

    use "concatenate" or "+" and "\t".... for format your output in ONE single println.
    Last edited by johnbee; May 30th, 2014 at 03:39 PM.

Similar Threads

  1. System.out.println Error when using Iterator
    By willo009 in forum Collections and Generics
    Replies: 7
    Last Post: August 30th, 2013, 02:08 AM
  2. Need help with System.out.println
    By meghabachani in forum Java Theory & Questions
    Replies: 3
    Last Post: June 6th, 2013, 02:55 AM
  3. System.out.println Not Working
    By manjula in forum JavaServer Pages: JSP & JSTL
    Replies: 6
    Last Post: November 27th, 2012, 07:25 AM
  4. How to modify System.out.println()
    By emailkia in forum Java Theory & Questions
    Replies: 6
    Last Post: April 25th, 2011, 12:40 AM
  5. what is System,out,println in System.out.println()?
    By koteshk in forum Java Theory & Questions
    Replies: 2
    Last Post: April 18th, 2011, 12:28 AM

Tags for this Thread