Groups | Search | Server Info | Login | Register


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

Re: The greeting code in Java

From Roedy Green <see_website@mindprod.com.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: The greeting code in Java
Date 2011-06-19 21:23 -0700
Organization Canadian Mind Products
Message-ID <nditv65to0jlljmnfpf9hovqphedn2te5s@4ax.com> (permalink)
References <f61fee62-589e-4ad1-a9ef-a54e2b589e5b@s9g2000yqm.googlegroups.com>

Show all headers | View raw


On Sun, 19 Jun 2011 06:05:53 -0700 (PDT), Saeed Amrollahi
<amrollahi.saeed@gmail.com> wrote, quoted or indirectly quoted someone
who said :

>package Greeting;
>import java.io.*;
>
>public class Main {

packages are traditionally all lower case. e.g. "greeting".

Further they should be globally unique by including your domain name,
e.g.  "com.amrollahi.saeed.greeting". That way you can share code with
others without worrying about package name clashes.

Main is not a very descriptive name for a class. Try "Greeting".

The code itself works fine, though it is a "vortope" translation of C
rather than idiomatic Java. You forgot to close your stream.

An fairly easy extension is a while EOFException loop to handle more
than one name.

Thank you for compiling and running your code before asking help.  So
many newbies fail to do that.  You also explained what your code was
supposed to do.  These are lessons that seem almost impossible to get
into newbie heads.

-- 
Roedy Green Canadian Mind Products
http://mindprod.com
One of the great annoyances in programming derives from the irregularity
of English spelling especially when you have international teams.  
I want to find a method or variable, but I don't know precisely
how its is spelled or worded. English is only approximately phonetic.  
Letters are randomly doubled.  The dictionary often lists variant spellings.
British, Canadian and American spellings differ.I would like to see an 
experiment where variable names were spelled in a simplified English, where 
there were no double letters.I also think you could add a number of rules 
about composing variable names so that a variable name for something would
be highly predictable. You would also need automated enforcement of the 
rules as well as possible.

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:05 -0700
  Re: The greeting code in Java rossum <rossum48@coldmail.com> - 2011-06-19 17:36 +0100
    Re: The greeting code in Java Saeed Amrollahi <amrollahi.saeed@gmail.com> - 2011-06-19 12:15 -0700
      Re: The greeting code in Java Martin Gregorie <martin@address-in-sig.invalid> - 2011-06-19 19:46 +0000
        Re: The greeting code in Java Saeed Amrollahi <amrollahi.saeed@gmail.com> - 2011-06-19 22:34 -0700
          Re: The greeting code in Java Jukka Lahtinen <jtfjdehf@hotmail.com.invalid> - 2011-06-23 11:43 +0300
        Re: The greeting code in Java Martin Gregorie <martin@address-in-sig.invalid> - 2011-06-20 10:13 +0000
          Re: The greeting code in Java Michael Wojcik <mwojcik@newsguy.com> - 2011-06-22 09:29 -0400
      Re: The greeting code in Java Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-06-19 16:00 -0400
      Re: The greeting code in Java Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-06-19 16:05 -0400
        Re: The greeting code in Java Saeed Amrollahi <amrollahi.saeed@gmail.com> - 2011-06-19 22:40 -0700
      Re: The greeting code in Java rossum <rossum48@coldmail.com> - 2011-06-19 22:28 +0100
  Re: The greeting code in Java Roedy Green <see_website@mindprod.com.invalid> - 2011-06-19 21:14 -0700
  Re: The greeting code in Java Roedy Green <see_website@mindprod.com.invalid> - 2011-06-19 21:23 -0700
  Re: The greeting code in Java blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-06-20 19:20 +0000
    Re: The greeting code in Java Ney André de Mello Zunino <zunino@softplan.com.br> - 2011-06-22 15:55 -0300

csiph-web