Groups | Search | Server Info | Keyboard shortcuts | Login | Register


Groups > comp.lang.java.programmer > #5374

Re: The greeting code in Java

From Saeed Amrollahi <amrollahi.saeed@gmail.com>
Newsgroups comp.lang.java.programmer
Subject Re: The greeting code in Java
Date 2011-06-19 06:44 -0700
Organization http://groups.google.com
Message-ID <06cf6f85-5473-47da-b599-de2e7f81976d@d1g2000yqm.googlegroups.com> (permalink)
References <3d6aab49-9a4a-4614-af12-bb1c95bebbe7@w4g2000yqm.googlegroups.com> <4dfdf77e$0$4132$426a74cc@news.free.fr>

Show all headers | View raw


On Jun 19, 4:19 pm, Aéris <ae...@imirhil.fr> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> public class Main {
>         public static void main(final String[] args) throws IOException {
>                 final BufferedReader in = new BufferedReader(
>                         new InputStreamReader(System.in));
>                 String s;
>                 while ((s = in.readLine()) != null && s.length() > 0) {
>                         System.out.print("Please enter your first name:");
>                         System.out.println("Hello, " + s);
>                 }
>         }
>
> }
>
> - --
> Aeris

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?
after username data entry we'll have the following output:
  Aeris
  Please enter your first name:Hello, Aeris
Also, please note In C++, the I/O operation using << and >>
are formatted, but in both code, we read the input, until
we reach the end of line.
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?

Regards,
  -- Saeed

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

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