Groups | Search | Server Info | Login | Register
Groups > comp.lang.java.programmer > #5397
| From | Saeed Amrollahi <amrollahi.saeed@gmail.com> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: The greeting code in Java |
| Date | 2011-06-19 12:05 -0700 |
| Organization | http://groups.google.com |
| Message-ID | <ad3c6445-29ae-4cc3-9887-c52d30d04570@n28g2000vbs.googlegroups.com> (permalink) |
| References | <3d6aab49-9a4a-4614-af12-bb1c95bebbe7@w4g2000yqm.googlegroups.com> <4dfdf77e$0$4132$426a74cc@news.free.fr> <06cf6f85-5473-47da-b599-de2e7f81976d@d1g2000yqm.googlegroups.com> <4dfe0ce7$0$4853$426a74cc@news.free.fr> |
On Jun 19, 6:51 pm, Aéris <ae...@imirhil.fr> wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Le 19/06/2011 15:44, Saeed Amrollahi a écrit : > > > Thank you for your immediate answer. I ran your program and > > it doesn't exactly did as the C++ version. First, > > a message is printed and ask the user name, then the greeting > > message is appeared on screen. In you program, no asking message > > is appeared and the user can't figure out what should he/she do? > > Yes, indeed, i did a mistake. > Replace the .print( with a .println(, othewise output is not flushed and > the greeting appear only after output. > Now it OK. > > You used the BufferedReader and InputStreamReader classes. > > From point of educational view, do you think my code or your code > > is as simple as the C++ version? > > Our C⁺⁺ version *seems* simplest, but concepts behind >> and << are very > complex and can be very dangerous (overriden operator). > As you said, may be the concepts behind them are complex (I don't agree with you), but their usage is really simple. > And in your code, I don't no if you know the difference, but std::endl > is very very dangerous. It's not just equal to EOL but also flush the > buffer. It's not dangerous. but my answer: use '\n' rather than std::endl; > This bad shortcut lead to very poor i/o performances in most of > applications, all outputs flushing continuously buffer instead just send > EOL. > > All of those considered, C⁺⁺ code is the shortest but not the simplest =) > BTW, thank you for your insightful answers. > - -- > Aeris > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.11 (GNU/Linux) > Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org/ > > iQEcBAEBAgAGBQJN/gziAAoJEK8zQvxDY4P9ChUH/0PevuUF1gmjz7VuPsc1+31L > 3nNsrpg3TP343pz3jujbAhR8kKaTML44U/tX9TRtadGOfcfe1iurJv1FJ1qajmFn > nSXlDVSOB9QeI1RTZ0w5pkZt85jJxw3Mdun8K3c9XVfNts9pIVowgLJZ7kQNt/CO > y3RdMu0zq70DEFo8EEYuCfuo4F4OmdVQ0vk+EdFwo9vtBTgr6VPn2t+RLrOGZfUN > CZGOYYFwezH4+8WYiMOKEtHIS2fKIDE46bID957jbvo3qLRA6058bi5cPU6zyzXz > hdlzY59kdo/EstMG7Jo44qEpIqD0jzdgxUQVyZNWt7+8ghFnBOTcURlw/YiUa9k= > =You3 > -----END PGP SIGNATURE-----
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar
The greeting code in Java Saeed Amrollahi <amrollahi.saeed@gmail.com> - 2011-06-19 06:06 -0700
Re: The greeting code in Java Aéris <aeris@imirhil.fr> - 2011-06-19 15:19 +0200
Re: The greeting code in Java Saeed Amrollahi <amrollahi.saeed@gmail.com> - 2011-06-19 06:44 -0700
Re: The greeting code in Java Jeff Higgins <jeff@invalid.invalid> - 2011-06-19 10:13 -0400
Re: The greeting code in Java Saeed Amrollahi <amrollahi.saeed@gmail.com> - 2011-06-19 07:17 -0700
Re: The greeting code in Java Jeff Higgins <jeff@invalid.invalid> - 2011-06-19 11:01 -0400
Re: The greeting code in Java Saeed Amrollahi <amrollahi.saeed@gmail.com> - 2011-06-19 12:06 -0700
Re: The greeting code in Java Aéris <aeris@imirhil.fr> - 2011-06-19 22:06 +0200
Re: The greeting code in Java Saeed Amrollahi <amrollahi.saeed@gmail.com> - 2011-06-19 22:33 -0700
Re: The greeting code in Java RedGrittyBrick <RedGrittyBrick@spamweary.invalid> - 2011-06-20 16:36 +0100
Re: The greeting code in Java Jeff Higgins <jeff@invalid.invalid> - 2011-06-20 12:25 -0400
Re: The greeting code in Java Jeff Higgins <jeff@invalid.invalid> - 2011-06-20 13:00 -0400
Re: The greeting code in Java Jeff Higgins <jeff@invalid.invalid> - 2011-06-20 15:24 -0400
Re: The greeting code in Java blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-06-20 19:23 +0000
Re: The greeting code in Java Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-06-19 16:25 -0400
Re: The greeting code in Java Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-06-19 17:22 -0400
Re: The greeting code in Java Jeff Higgins <jeff@invalid.invalid> - 2011-06-19 12:08 -0400
Re: The greeting code in Java "Nasser M. Abbasi" <nma@12000.org> - 2011-06-19 19:35 -0700
Re: The greeting code in Java "Nasser M. Abbasi" <nma@12000.org> - 2011-06-19 21:41 -0700
Re: The greeting code in Java Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-06-20 01:02 -0400
Re: The greeting code in Java Aéris <aeris@imirhil.fr> - 2011-06-19 16:51 +0200
Re: The greeting code in Java Stanimir Stamenkov <s7an10@netscape.net> - 2011-06-19 18:06 +0300
Re: The greeting code in Java Aéris <aeris@imirhil.fr> - 2011-06-19 17:24 +0200
Re: The greeting code in Java Jeff Higgins <jeff@invalid.invalid> - 2011-06-19 11:37 -0400
Re: The greeting code in Java Jeff Higgins <jeff@invalid.invalid> - 2011-06-19 11:40 -0400
Re: The greeting code in Java Saeed Amrollahi <amrollahi.saeed@gmail.com> - 2011-06-19 12:05 -0700
Re: The greeting code in Java blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-06-20 19:21 +0000
Re: The greeting code in Java Jeff Higgins <jeff@invalid.invalid> - 2011-06-19 10:31 -0400
Re: The greeting code in Java Saeed Amrollahi <amrollahi.saeed@gmail.com> - 2011-06-19 11:36 -0700
Re: The greeting code in Java Jeff Higgins <jeff@invalid.invalid> - 2011-06-19 15:03 -0400
Re: The greeting code in Java blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-06-20 19:22 +0000
Re: The greeting code in Java Tobias Blass <tobiasblass@gmx.net> - 2011-06-21 07:44 +0000
Re: The greeting code in Java Tobias Blass <tobiasblass@gmx.net> - 2011-06-21 09:34 +0000
Re: The greeting code in Java Gene Wirchenko <genew@ocis.net> - 2011-06-21 07:47 -0700
Re: The greeting code in Java blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-06-21 20:43 +0000
Re: The greeting code in Java Tobias Blass <tobiasblass@gmx.net> - 2011-06-22 08:35 +0000
Re: The greeting code in Java blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-06-22 20:04 +0000
Re: The greeting code in Java Stanimir Stamenkov <s7an10@netscape.net> - 2011-06-19 19:07 +0300
Re: The greeting code in Java Saeed Amrollahi <amrollahi.saeed@gmail.com> - 2011-06-19 12:08 -0700
Re: The greeting code in Java Jeff Higgins <jeff@invalid.invalid> - 2011-06-19 13:07 -0400
Re: The greeting code in Java Jeff Higgins <jeff@invalid.invalid> - 2011-06-19 13:11 -0400
Re: The greeting code in Java Jeff Higgins <jeff@invalid.invalid> - 2011-06-19 14:19 -0400
csiph-web