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.

404 questions
15
votes
6 answers

Why does ('1'+'1') output 98 in Java?

I have the following code: class Example{ public static void main(String args[]){ System.out.println('1'+'1'); } } Why does it output 98?
Robin
  • 165
  • 7
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,577
  • 6
  • 20
  • 32
13
votes
4 answers

Where System.out writes in a servlet?

I am just curious to know, what happens when System.out.print() is called in a servlet? Where does it write the text? Or is there any significant use of System.out in a servlet?
vivek_jonam
  • 3,237
  • 8
  • 32
  • 44
12
votes
3 answers

Print a carriage return in java on windows on console

On my OS X machine, the following line gives me a nice and easy way to track the state of my loops: for (int index = 0; index < 100; index++) for (int subIndex = index; subIndex < 100; subIndex++) System.out.print("\r" + index + "/" +…
F.P
  • 17,421
  • 34
  • 123
  • 189
12
votes
4 answers

Differences between System.out.println() and return in Java

I'm trying to understand the difference, and benefits of using System.out.println() vs. return blah in a method. It seems like System.out.println() is used to display static information, and return is a value returned from the method. Yet I'm seeing…
ObiWanShanobi
  • 442
  • 1
  • 5
  • 10
9
votes
6 answers

Time complexity of system.out.println

I've been told different things over my course on algorithms, and was wondering if I could get a definitive answer as to the time complexity of Java's System.out.println() command. For example, what would the time complexity of the following be,…
Addison
  • 7,322
  • 2
  • 39
  • 55
8
votes
2 answers

what is the purpose of using System.out.println()

I was going through the internal implementation of System.out.println().Though I understood how this is working but couldn't figure out : Why they decided to use the System class in the first place. They could have directly used PrintStream class…
Ankush Dutt
  • 143
  • 8
8
votes
1 answer

System.out.println prints out of order in Play Framework console

I'm using Play 2.4 with Activator 1.3.7, and I'm noticing System.out.println doesn't always print in order to the console in the browser. It's pretty rare, but I caught it in action today. Here's the order of the print statements: …
Indigenuity
  • 9,332
  • 6
  • 39
  • 68
8
votes
3 answers

What is System.out exactly?

I noticed that any call to System.out.println() from a JAR file that hasn't been started by the command line (i.e. a Runnable JAR file started by user with double-click) won't open the console. After doing some research, I found multiple answers on…
spongebob
  • 8,370
  • 15
  • 50
  • 83
8
votes
3 answers

Cause runtime exceptions to be properly ordered with println in console output

A common problem with VM Java console output is that System.out and System.err are not usually synchronized properly, possibly because they are on different threads. This results in mixed up output such as the following: debugging output mixed up…
Tyler Durden
  • 11,156
  • 9
  • 64
  • 126
7
votes
1 answer

Will Java's System.out.print() buffer forever until println()?

I overheard an argument about System.out.print() today. One person claimed that since print() doesn't including the terminating \n, the buffer it writes to will eventually fill up and start losing data. The other person claimed that they had been…
Chris Maness
  • 1,682
  • 3
  • 22
  • 40
7
votes
7 answers

How to add empty space inside int?

Let's say I want to print the number 100000000. At first sight it is difficult to tell how many millions this number is representing. Is it 10 million or 100 million? How can I make big numbers in Java look more readable? Something like this for…
Sing Sandibar
  • 714
  • 4
  • 15
  • 26
7
votes
2 answers

System.out messed up after Jackson serialization

I've been trying to serialize some Objects to System.out (for debugging). As soon as I call final JsonSerializer serializer = new JsonSerializer(); serializer.serialize( System.out, myObj ); System.out.println("done"); it prints out the json, but…
gorootde
  • 4,003
  • 4
  • 41
  • 83
7
votes
2 answers

Can I talk Java into printing to the console under Mountain Lion?

I'm using the good old System.out.println - approach to debug my Java application. Before I upgraded to Mac OS 10.8 this worked wonderfully. Now however my console wouldn't display anything. Apparently I'm not the first one to encounter this…
Maximilian Tyrtania
  • 437
  • 1
  • 4
  • 14
7
votes
2 answers

Why is System.out.print() not working?

So I'm in the thick of coding what I though would be a relatively simple "read file" program. I am getting LOTS of compile errors, so I started just trying to compile one line at a time to see where I was getting hosed. Here's where I am so…
dwwilson66
  • 6,806
  • 27
  • 72
  • 117
1
2
3
26 27