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


Groups > comp.lang.java.help > #1104

Re: Trouble with updating reference variables through method calls

From Roedy Green <see_website@mindprod.com.invalid>
Newsgroups comp.lang.java.help
Subject Re: Trouble with updating reference variables through method calls
Date 2011-09-22 20:33 -0700
Organization Canadian Mind Products
Message-ID <0avn775m2047pj69aoru42hcr4aq0ferhq@4ax.com> (permalink)
References <3bf29bca-0e7e-4104-8b55-2e4589dd2ce9@x32g2000prf.googlegroups.com>

Show all headers | View raw


On Thu, 22 Sep 2011 17:42:22 -0700 (PDT), Fred
<albert.xtheunknown0@gmail.com> wrote, quoted or indirectly quoted
someone who said :

> private static void getNewFoo() {
>        Foo foo = new Foo();
>        return foo

The word "get" in a method name has special meaning. It is confusing
when you use it here for a static method.

The method returns a Foo, not a void.

This is what is called a Factory. There is not much point to it unless
it sometimes does something other than new Foo().
You could invoke new Foo() as tersely as getNewFoo();

-- 
Roedy Green Canadian Mind Products
http://mindprod.com
It should not be considered an error when the user starts something
already started or stops something already stopped. This applies
to browsers, services, editors... It is inexcusable to 
punish the user by requiring some elaborate sequence to atone,
e.g. open the task editor, find and kill some processes.

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


Thread

Trouble with updating reference variables through method calls Fred <albert.xtheunknown0@gmail.com> - 2011-09-22 17:42 -0700
  Re: Trouble with updating reference variables through method calls Lew <lewbloch@gmail.com> - 2011-09-22 18:01 -0700
  Re: Trouble with updating reference variables through method calls Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-09-22 22:47 -0400
  Re: Trouble with updating reference variables through method calls Roedy Green <see_website@mindprod.com.invalid> - 2011-09-22 20:29 -0700
  Re: Trouble with updating reference variables through method calls Roedy Green <see_website@mindprod.com.invalid> - 2011-09-22 20:33 -0700
  Re: Trouble with updating reference variables through method calls Roedy Green <see_website@mindprod.com.invalid> - 2011-09-22 20:34 -0700
  Re: Trouble with updating reference variables through method calls Travers Naran <tnaran@gmail.com> - 2011-09-22 21:27 -0700

csiph-web