• Post Reply Bookmark Topic Watch Topic
  • New Topic

Netbeans and Eclipse compiler's output is different  RSS feed

 
Hasan Fatih
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I was trying to execute the following codes, but the something that I don't undestand was happen. The program was compiled differently according to ouput picture of the program in my java book. Furthermore, then I tried to compile the program in eclipse and NetBeans. I saw that all of output are different each other. I think output of the book is sensible, but I couldn't see this output on the compilers. Can anybody explain this stutation? What is the problem?



The output In My Book:
Method throwException
Exception handled in method throwException
Finally executed in throwException
Exception handled in main
Method doesNotThrowException
Finally executed in doesNotThrowException
End of method doesNotThrowException


The output On NetBeans:
Method throwException
Method doesNotThrowException
Exception handled in method throwException
End of method doesNotThrowException
Finally executed in throwException
Finally executed in doesNotThrowException



The output On Eclipse:
Method throwException
Exception handled in method throwException
Finally executed in throwException
Method doesNotThrowException
End of method doesNotThrowException
Finally executed in doesNotThrowException
 
Stephan van Hulst
Saloon Keeper
Posts: 7993
143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Hasan, welcome to CodeRanch!

The reason is because you're writing some messages to System.out, and some messages to System.err.

These streams are being flushed at unpredictable times, so their output may appear in random order in respect to each other.
 
Hasan Fatih
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you.

I understand you. After I had seen your message, I edited all of the "err" to "out" and I saw that the order in the ouput on the netbeans is similar to my book except for one line. One line is hidden on the compiler's output: "Exception handled in main". What do you think this problem?

Edit:
Sorry, I noticed that I wrote the code incomplete. I must add a line to the program above:

.
 
Campbell Ritchie
Marshal
Posts: 56592
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hope it is not too late to welcome you to the Ranch I was away over the weekend.

I suggest you edit all your changes back so everything reads System.err
That is because you are dealing with error messages, even artificial ones caused by trying out Exceptions, and error messages should go to System.err. System.out is for normal output.
 
Hasan Fatih
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No problem. I undestand that you said. Thank you.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!