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


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

Re: Question regarding methods and classes

From markspace <-@.>
Newsgroups comp.lang.java.programmer
Subject Re: Question regarding methods and classes
Date 2011-10-23 07:43 -0700
Organization A noiseless patient Spider
Message-ID <j8196s$rp5$1@dont-email.me> (permalink)
References <4ea389df$0$13444$9a566e8b@news.aliant.net> <j807nt$8h6$1@dont-email.me> <j807ru$8h6$2@dont-email.me> <4ea4177e$0$19700$9a566e8b@news.aliant.net>

Show all headers | View raw


On 10/23/2011 6:32 AM, Linus Flustillbe wrote:

> I understand the concept of overloading methods... I haven't done much
> Java in few years so I'm taking a refresher by going through the Java


More on overloading:
<http://download.oracle.com/javase/tutorial/java/javaOO/methods.html>


> Tutorial.  What does adding the "static" modifier to the import
> statement do?  Since the methods in the rType class are already defined
> as being static (only one instance no matter how many times the class is
> instantiated ... see I read up on that)  why do we need the modifier
> except to make the code compile?  Or is that the only reason.. because
> Java needs it?


By default "import" brings in class definitions, not the members of the 
class.  So

   import helperClasses.rType;

would import the class, and you'd have to use

   rType.isBetween( x, y, z);

C.f. that link Peter gave you, which uses this style of static method 
access.  "Import static" is a special import syntax that imports only 
the static members of rType, not the class definition, so that you can 
use its static methods and fields "bare," without a class name as a 
qualifier.  It's a convenience for typing (and reading), nothing else.

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


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