Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


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

Re: Help with methods, classes and parameters

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From Scott Dunning <scottwd01@gmail.com>
Newsgroups comp.lang.java.programmer
Subject Re: Help with methods, classes and parameters
Date Wed, 30 Jul 2014 22:01:00 -0700
Organization A noiseless patient Spider
Lines 38
Message-ID <lrcidd$ndj$1@dont-email.me> (permalink)
References <lra1dp$9jh$1@dont-email.me> <lra7be$l2s$1@gregory.bnet.hr> <53d993b9$0$299$14726298@news.sunsite.dk> <lrc70j$rht$1@dont-email.me>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 8bit
Injection-Date Thu, 31 Jul 2014 04:58:21 +0000 (UTC)
Injection-Info mx05.eternal-september.org; posting-host="11828741c91d0da908948c6ecdf164c7"; logging-data="23987"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+mzxVZVMBlu3zHGz8AYa7l0dIJwwaSRMw="
User-Agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.6.0
In-Reply-To <lrc70j$rht$1@dont-email.me>
Cancel-Lock sha1:eLpEc+CAjYO6c/mc3deXFgX1Mb8=
Xref csiph.com comp.lang.java.programmer:29454

Show key headers only | View raw


On 7/30/14, 6:43 PM, markspace wrote:
> On 7/30/2014 5:54 PM, Arne Vajhøj wrote:
>
>> One should just be aware that there are some (few but some) cases
>> where static and inner classes make sense.
>
> Just to toss out an example of static methods, when a class's purpose is
> only to provide functions (and sometimes helpful utility methods), you
> should make all the methods static, and make the class final and
> non-instantiable.
>
> For example, the java.lang.Math class contains only mathematical
> functions.  All of its methods are static, and the class itself it final
> and non-instantiable.
>
> package myproject;
>
> public class MyUtilities {
>
>    // all private ctors makes the class final and
>    // non-instantiable.
>
>    private MyUtilities() {}
>
>    public static void doThis() { ...
>    }
>
>    public static double calculateThat() { ...
>    }
>
> }
>
>
Thanks everyone, you helped me understand everything a lot more!

I have another quick question.  One of the options in in the menu is if 
the user enter 0 to quit the program.  I'm not sure how to go about that 
in the switch statement?

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


Thread

Help with methods, classes and parameters Scott Dunning <scottwd01@gmail.com> - 2014-07-29 22:58 -0700
  Re: Help with methods, classes and parameters Josip Almasi <joe@vrspace.org> - 2014-07-30 09:37 +0200
    Re: Help with methods, classes and parameters Scott Dunning <scottwd01@gmail.com> - 2014-07-30 16:59 -0700
      Re: Help with methods, classes and parameters Josip Almasi <joe@vrspace.org> - 2014-07-31 10:42 +0200
    Re: Help with methods, classes and parameters Scott Dunning <scottwd01@gmail.com> - 2014-07-30 17:29 -0700
    Re: Help with methods, classes and parameters Arne Vajhøj <arne@vajhoej.dk> - 2014-07-30 20:54 -0400
      Re: Help with methods, classes and parameters markspace <markspace@nospam.nospam> - 2014-07-30 18:43 -0700
        Re: Help with methods, classes and parameters Scott Dunning <scottwd01@gmail.com> - 2014-07-30 22:01 -0700
          Re: Help with methods, classes and parameters markspace <markspace@nospam.nospam> - 2014-07-31 09:45 -0700
            Re: Help with methods, classes and parameters Steven Simpson <ss@domain.invalid> - 2014-08-01 09:00 +0100
              Re: Help with methods, classes and parameters markspace <markspace@nospam.nospam> - 2014-08-01 09:07 -0700
            Re: Help with methods, classes and parameters Jukka Lahtinen <jtfjdehf@hotmail.com.invalid> - 2014-08-01 12:02 +0300
  Re: Help with methods, classes and parameters Jeff Higgins <jeff@invalid.invalid> - 2014-07-30 17:57 -0400

csiph-web