Questions tagged [system.out]

Predefined stream object attached to the standard output in Java console applications.

It's a static variable in Java's System class. This tag is intended for questions about Java applications that write to the standard output.

386 questions
2831
votes
3 answers

Why is printing "B" dramatically slower than printing "#"?

I generated two matrices of 1000 x 1000: First Matrix: O and #. Second Matrix: O and B. Using the following code, the first matrix took 8.52 seconds to complete: Random r = new Random(); for (int i = 0; i < 1000; i++) { for (int j = 0; j < 1000;…
Kuba Spatny
  • 24,958
  • 9
  • 33
  • 58
127
votes
13 answers

How to color System.out.println output?

How can I color Java output? For example in C and other languages I can use ANSI-escape like \033[0m to do this. But in Java it doesn't work. public static void main(String[] x) { System.out.println("\033[0m BLABLA \033[0m\n"); }
Davide Aversa
  • 4,368
  • 6
  • 25
  • 36
79
votes
10 answers

How can I make Java print quotes, like "Hello"?

How can I make Java print "Hello"? When I type System.out.print("Hello"); the output will be Hello. What I am looking for is "Hello" with the quotes("").
Roy
  • 837
  • 2
  • 8
  • 7
60
votes
19 answers

What's the meaning of System.out.println in Java?

Is this static println function in out class from System namespace? namespace System { class out { static println ... } How can I interpret this name? And where in JRE this function is defined? In java.lang.System/java.lang.Object?
prosseek
  • 155,475
  • 189
  • 518
  • 818
56
votes
7 answers

difference between System.out.println() and System.err.println()

What is the difference between System.out.println() and System.err.println() in Java?
user354299
  • 2,575
  • 4
  • 17
  • 10
39
votes
3 answers

What is System, out, println in System.out.println() in Java

Possible Duplicate: What's the meaning of System.out.println in Java? I was looking for the answer of what System, out and println are in System.out.println() in the Java. I searched and found a different answer like these: System is a built-in…
Dinup Kandel
  • 2,389
  • 4
  • 19
  • 36
24
votes
9 answers

How does System.out.print() work?

I have worked with Java for a quite a long time, and I was wondering how the function System.out.print() works. Here is my doubt: Being a function, it has a declaration somewhere in the io package. But how did Java developers do that, since this…
kishoredbn
  • 1,765
  • 4
  • 22
  • 41
22
votes
2 answers

Why does `System.out.println(null);` give "The method println(char[]) is ambiguous for the type PrintStream error"?

I am using the code: System.out.println(null); It is showing the error: The method println(char[]) is ambiguous for the type PrintStream Why doesn't null represent Object?
Kannan Thangadurai
  • 1,047
  • 1
  • 16
  • 31
20
votes
3 answers

Why don't we close `System.out` Stream after using it?

I just want to know, we usually close streams at the end, but why don't we close System.out PrintStream with System.out.close()?
Eng.Fouad
  • 107,075
  • 62
  • 298
  • 390
18
votes
4 answers

How to make a Logger for System.out

I am wondering how to get org.slf4j.Logger for System.out. I know this is not good, but I need it for testing purposes. Thank you so much.
Anton K.
  • 875
  • 3
  • 9
  • 22
18
votes
3 answers

Race between System.out and System.err in java

Please consider this java code: public class CMain { public static void main(String[] args){ for (int i = 0; i < 10; i++) { System.out.println("A"); System.err.println("B"); } } } By a quick look at…
C graphics
  • 6,750
  • 18
  • 75
  • 124
17
votes
8 answers

What is the equivalent of Java's System.out.println() in Javascript?

I am writing some tests for Javascript code and I need to dump some messages during the compile process when errors are encountered. Is there any equivalent to Java's System.out.println() in Javascript? P.S.: I also need to dump debug statements…
Jérôme Verstrynge
  • 51,859
  • 84
  • 263
  • 429
16
votes
9 answers

How to set a string's color

Does anyone know how I would set the color of a string that will be printed using System.out? This is the code I currently have: System.out.println("TEXT THAT NEEDS TO BE A DIFFERENT COLOR.");
guess who
15
votes
10 answers

Disable System.out for speed in Java

I'm writing a program in java that simulates gravity, and in it I have a bunch of log statements (to System.out). My program is running really slowly, and I think the logging might be part of the reason. Is there any way to disable System.out, so…
Gavin S. Yancey
  • 1,179
  • 1
  • 11
  • 29
15
votes
3 answers

What happens to "System.out.println()" in executable jar?

Suppose I've created an executable jar from a code where I have used System.out.println() When we run the executable jar, there is no console. So, what happens to this line? How does java handle this situation? EDIT 01: NOTE: The situation is when…
Minar Mahmud
  • 2,289
  • 6
  • 18
  • 29
1
2 3
25 26