Questions tagged [println]

In programming, `println` generally prints out the arguments given, then moves to a new line for subsequent output.

In programming, println generally outputs the arguments supplied, then moves to a new line for any further output operations. For example, in Java you could write the following:

System.out.print("Hello ");
System.out.println("World");
System.out.println("Goodbye");

And the console would output (with \n representing newline characters):

Hello World\n
Goodbye\n

There are several languages that use the println() method; Others have different syntax that accomplishes the same functionality.

617 questions
4
votes
2 answers

Print and println aren't executed in the same time

I have a method in my servlet where I have some prints to the console.. private void collectingWorkPositions(HttpSession session, HttpServletRequest request) { System.out.println("Collecting1.."); //code... …
yaylitzis
  • 5,354
  • 17
  • 62
  • 107
4
votes
3 answers

Swift: format console-log

is there any possibility to create a custom log function? This is how the default println("hello world") looks like: 2015-03-04 18:33:55.788 MyApp[12345:671253923] Hello World I would like to output something like: 18:33 MyClass > myFunc [line 1]…
Michael
  • 1,030
  • 14
  • 29
4
votes
2 answers

What is in android.util.Log#println_native()?

Here is the android.util.Log source code. At the very bottom (line 340), what is in the method: public static native int println_native(int bufID, int priority, String tag, String msg); i guess println_native() is more or less like its…
midnite
  • 5,157
  • 7
  • 38
  • 52
4
votes
6 answers

Java, end of line with system.out.print

I have done some research concerning System.out.print() and System.out.println() and I discovered that System.out.println() add the end of line at the end of printed line. System.out.println("Test"); Output only : Test but does not print end of…
metraon
  • 1,229
  • 2
  • 11
  • 26
4
votes
1 answer

Java - Redirecting system.out.println to a JLabel

I want to redirect a sytem.out.println to a JLabel in another class. I have 2 classes, NextPage and Mctrainer. NextPage is basically just a Jframe (The gui for my project), and I have created a Jlabel in Nextpage using this code; public class…
user1880046
  • 59
  • 1
  • 1
  • 2
4
votes
5 answers

Scala a better println

I often find myself doing things like: println(foo) when I'd like to do: println foo The compiler does not allow this. Also, println is a mouthful, I really just want to say: echo foo So, in a base package object I created the echo version of…
virtualeyes
  • 11,147
  • 6
  • 56
  • 91
3
votes
1 answer

PrintWriter only sending part of string Java

I'm doing some socket work in Java, and am trying to encode the data it is sending. That part is working correctly, but for some reason it doesn't send the whole encoded String over the socket. It seems to send it in parts of 3. The client performs…
Lolmewn
  • 1,491
  • 4
  • 17
  • 38
3
votes
1 answer

System.out.println() behavior on surrogate pair char[]

When I execute the code: char[] c1 = {'a','b'}; char[] c2 = Character.toChars(0x10437); System.out.println(c1); System.out.println(c2); I get: ab By reading the documentation of Character.toChars, I get that c2 is a char array of size 2, which is…
Ida
  • 2,919
  • 3
  • 32
  • 40
3
votes
1 answer

Can I print a case class param that is passed to class function in Scala?

I am trying to print an object that is passed to a class function in scala. The case class is written: config { ... case class NetConfig( domain: NetDomain, prodDomain: NetDomain, @ConfigName("base_url") baseUrl: BaseUrl, …
gwhiz
  • 135
  • 9
3
votes
3 answers

How to print from go test to console without using verbose option

I want to print an informative message to console from a test, but not have the verbose test output. I have tried printing from the test using: fmt.Println("my message") // STDOUT fmt.Fprintln(os.Stderr, "my message") // STDERR t.Log("my…
Bohemian
  • 412,405
  • 93
  • 575
  • 722
3
votes
3 answers

How to execute a block of code for every command line argument given, but print it in one line

I've been trying to achieve this for a week with no success. I would like the program to print command line arguments in brackets like shown below (in one line): ---------- +++++++++++ --------- ++++++++ - orange - + apricot + - grape - + kiwi +…
Eva
  • 41
  • 4
3
votes
2 answers

Does System.out.println() have any other use than printing output to the console?

I was asked the following question during an interview: Does System.out.println() have any other use than printing output to the console?
3
votes
2 answers

Is there a way to format your output so that it comes out more uniformly?

I have a long string and everything is right, but I am unable to get the same output as the prof. He has a more uniform output. So first I tried to do a system.out.println(), but that did not work. This is my code: System.out.println("Password = "…
3
votes
3 answers

Why multiple calls of System.out.println prints values in single line

It is just a funny question. Not a real code for production. I do not want to fix it. I just want to understand this strange behavior. I have the code that should print "1" in each line. Actually, it is false. I get the strange result like…
Paul
  • 580
  • 1
  • 7
  • 22
3
votes
1 answer

Kotlin overload resolution ambiguity in Pair with reference to println

Using a reference to println as a Pair element fails when the reference is the first in the Pair. >>> 0 to ::println produces (0, fun println(): kotlin.Unit) but >>> ::println to 0 gives error: overload resolution…
juanma
  • 88
  • 6