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


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

Re: Question regarding methods and classes

Date 2011-10-22 20:44 -0700
From Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com>
Newsgroups comp.lang.java.programmer
Subject Re: Question regarding methods and classes
References <4ea389df$0$13444$9a566e8b@news.aliant.net>
Message-ID <F_GdndVSBOITED7TnZ2dnUVZ_jidnZ2d@posted.palinacquisition> (permalink)

Show all headers | View raw


On 10/22/11 8:28 PM, Linus Flustillbe wrote:
> [...]
> So basically what I want to do is create a whole bunch of methods, put
> them in one class and have them all available on demand just by
> importing the class...no instantiations required.
> Make sense?   This is probably silly so if it is, just ignore me..I'll
> go away

Not silly at all.  If I understand your question correctly, you are 
asking about "static" methods (not to be confused with "static nested 
classes" :( ).  That is, a method that can be called using the type 
name, rather than an instance reference.

They can be quite useful, when you need to implement some functionality 
that does not depend on some specific instance data.

You can also have static data members; those members are, like the 
static methods, referenced using the type name rather than an instance 
reference.

See http://download.oracle.com/javase/tutorial/java/javaOO/classvars.html

Pete

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


Thread

Question regarding methods and classes Linus Flustillbe <admin@nacs.dyndns-office.com> - 2011-10-23 03:28 +0000
  Re: Question regarding methods and classes Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2011-10-22 20:44 -0700
    Re: Question regarding methods and classes Patricia Shanahan <pats@acm.org> - 2011-10-23 06:14 +0100
  Re: Question regarding methods and classes markspace <-@.> - 2011-10-22 22:12 -0700
    Re: Question regarding methods and classes markspace <-@.> - 2011-10-22 22:14 -0700
      Re: Question regarding methods and classes Linus Flustillbe <admin@nacs.dyndns-office.com> - 2011-10-23 13:32 +0000
        Re: Question regarding methods and classes markspace <-@.> - 2011-10-23 07:43 -0700
        Re: Question regarding methods and classes Lew <lewbloch@gmail.com> - 2011-10-23 08:54 -0700
  Re: Question regarding methods and classes Roedy Green <see_website@mindprod.com.invalid> - 2011-10-23 01:37 -0700
    Re: Question regarding methods and classes Linus Flustillbe <admin@nacs.dyndns-office.com> - 2011-10-23 13:49 +0000
      Re: Question regarding methods and classes Roedy Green <see_website@mindprod.com.invalid> - 2011-11-02 01:23 -0700
  Re: Question regarding methods and classes Linus Flustillbe <admin@nacs.dyndns-office.com> - 2011-10-23 09:11 +0000

csiph-web