Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 a "System.out.println" question...
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
princess




PostPosted: Mon Feb 09, 2004 7:06 pm   Post subject: a "System.out.println" question...

when i am using System.out.println... in a loop how do i make everything appear on one line??
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Mon Feb 09, 2004 7:07 pm   Post subject: (No subject)

well println is a line Confused you have to use
code:

Systerm.out.print();

instead...
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
princess




PostPosted: Mon Feb 09, 2004 7:09 pm   Post subject: (No subject)

sooo theres no way i can do it with the \n or \t and the "special formatting commands?
Tony




PostPosted: Mon Feb 09, 2004 9:30 pm   Post subject: (No subject)

\n is the new line character. It creates a new line Laughing what .println does is it sticks \n at the end of your string for you.

Using .print instead should fix that problem Thinking
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Paul




PostPosted: Mon Feb 09, 2004 11:39 pm   Post subject: (No subject)

Maybe there's an assignment asking you not to use print but to use println, then you can add all the strings together and make one big println
Tony




PostPosted: Mon Feb 09, 2004 11:45 pm   Post subject: (No subject)

lol Laughing don't you guys just hate those assignments where they tell you something like
Quote:

now class... I know that our IDE comes with a library that allows us a 1 line solution, but instead I'd like you to research the topic and write up a 2 page chunk of code that runs at 1/100 efficiency


Laughing sorry.. but Paul Bian's comment just reminded me of all those times where kids used to spend days on base conversion programs in turing and then someone whould just whip out strint()+intstr() 2 line program that's the entire solution Laughing
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Paul




PostPosted: Mon Feb 09, 2004 11:47 pm   Post subject: (No subject)

Ha, that time was a few months ago for me.
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 7 Posts ]
Jump to:   


Style:  
Search: